Reputation: 11
I am new to Angular and I am trying to build a basic HelloWorld program to deploy to Google Cloud. However, I am getting the exception shown below.
These are the steps I have taken:
ng new
command.ng build --prod
command.gcloud app deploy
command to deploy the HelloWorld application.After all those steps, this is the error I am getting:
> [email protected] start /app
> ng serve
sh: 1: ng: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: `ng serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-04-24T17_23_25_110Z-debug.log
Please suggest what to do next.
Upvotes: 0
Views: 1001
Reputation: 25
I just had an error like this during deployment , (it was a rimraf not found error) and to solve that I just copy my devdependencies and add it in my dependencies in package.json file. I don't know If it is the right thing to do but it works for me ! Hope it helps someone
Upvotes: 1
Reputation: 1184
Since you are new to using Angular and you want to know how to deploy your Angular application to Google Cloud, here is a tutorial that may be helpful for you. It includes an example of an Angular application you can use as a reference to develop your own app. Just in case, I will also include an example on how to deploy a HelloWorld application using Node.js.
You can focus on the parts related to preparing the right setup, testing the sample application and deploying it to Google Cloud.
To put it simple, in your application's root directory, where files such as app.yaml
should be, you can run the following commands to prepare and test your application locally:
$ npm install
$ npm start
In the Cloud Shell, hit the web preview icon (the one that looks like a square eye) and select "Preview on port 8080" to check if the test application works.
If the test is successful, your next step would be to deploy the application into Google Cloud by running this:
$ gcloud app deploy
Once the deploy is finished, run this command to check if the deploy is correct:
$ gcloud app browse
It will point you to the address where your application is running, and check if the deployment has been successful.
Upvotes: 0
Reputation: 183
Firtsly install angular cli
Use this command : npm install -g angular-cli then try again hope it will work.
Upvotes: 1