1

Just to give you some context.

I was running a project and after ng serve I was getting this warning message:

our global Angular CLI version (9.1.4) is greater than your local version (1.0.0). The local Angular CLI version is used.

I googled and figured out I should update angular cli with the following command.

npm install --save -dev @angular/cli@latest

After that I am getting the following error when trying to build the project:

The build command requires to be run in an Angular project, but a project definition could not be found

Any help will be much appreciated.

1 Answer 1

4

After reading some issues reported on the GitHub repository, I found the solution.

In order to update the angular-cli package installed globally in your system, you need to run:

npm uninstall -g angular-cli npm install -g @angular/cli@latest 

Depending on your system, you may need to prefix the above commands with sudo.

Also, most likely you want to also update your local project version, because inside your project directory it will be selected with higher priority than the global one:

rm -rf node_modules npm uninstall --save-dev angular-cli npm install --save-dev @angular/cli@latest npm install 

After updating your CLI, you probably want to update your angular version too

Note: if you are updating to Angular CLI 6+ from an older version, you might need to read this

Edit: In addition, if you were still on a 1.x version of the cli, you need to convert your angular-cli.json to angular.json, which you can do with the following command:

ng update @angular/cli --from=1.7.4 --migrate-only 

check here for more details.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.