Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular `ng add` is invalid. For available options, see `ng help`

Tags:

angular

Image2Error Image

The specified command add is invalid. For available options, see ng help.

What could be wrong?

like image 978
Parth Raval Avatar asked Jan 25 '19 17:01

Parth Raval


1 Answers

You will need to update your Angular cli and Angular. Please read all of this before copy and pasting the commands into terminal.

The latest version for these are (as of writing this post):-

  • Angular (7.2.2)
  • Angular CLI (7.2.3)

Once you have update Angular to greater than version 6 you should be able to use the ng add command.

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

npm uninstall -g angular-cli
npm cache clean or npm cache verify
npm install -g @angular/cli@latest

You will also need to update it within your project

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

As your CLI version is still on 1.x 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

I hope you find this helpful.

like image 99
Web Nexus Avatar answered Sep 27 '22 20:09

Web Nexus