Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

You have to be inside an angular-cli project in order to use the build command after reinstall of angular-cli

Tags:

angular-cli

People also ask

Which CLI command is used to build the Angular application?

The ng new command creates an Angular workspace folder and generates a new application skeleton. A workspace can contain multiple applications and libraries. The initial application created by the ng new command is at the top level of the workspace.

Why the serve command requires to be run in an Angular project but a project definition could not be found?

This error often occurs when a project you are running is not an Angular project. It may also be the case when you download an Angular project but do not have latest dependencies installed on your machine. Installing latest dependencies should fix the problem.

Which command line interface tool is used to create build and deploy Angular applications?

ng buildlink. Compiles an Angular application or library into an output directory named dist/ at the given output path.


Same as John Pankowicz answer, but in my case I had to run

npm install -g @angular/cli@latest

for the versions to match.


npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli

use sudo on Mac/Linux.


Ok, found it.

package.json must contain a dependency to angular-cli.

When I uninstalled my local angular-cli, npm also removed the dependency entry.


It worked in my case

sudo npm uninstall -g angular-cli @angular/cli
sudo npm cache clean --force
npm install npm@latest -g
sudo npm install -g @angular/cli

I had the same error message. But the cause and solution are slightly different. When I ran "ng -v" it showed different versions for angular-cli (1.0.0-beta.28.3) and @angular/cli (1.0.0-beta.31). I re-ran:

npm install -g @angular/cli

Now both show a version of 1.0.0-beta.31. The error message is gone and "ng serve" now works. (Yes - it was @angular/cli that I re-installed and the angular-cli version was updated.)