-2

After I have executed the code:

npm install -g@angular/cli

ng commands don't work and my npm folder is also empty, it does not contain the angular files.

I have node version 12 and npm version above 6.

aschipfl
  • 33,626
  • 12
  • 54
  • 99

1 Answers1

0

First of all, make sure that Angular CLI was installed:

npm list -g --depth=0

If @angular/cli is not mentioned in the list, try to reinstall it:

npm install -g @angular/cli

Then you must be able to create a new project:

ng new my-dream-app
Viktor Gusev
  • 555
  • 3
  • 12
  • No @angular cli is not mentioned in the list and after running npm install -g@angular/cli and after that also the list doesn't contain @angular/cli. Please help i am badly stuck for many days – Anjaney Rai May 19 '20 at 03:52
  • after running npm install it says :npm warn user@1.0.0 no description.no repository field. – Anjaney Rai May 19 '20 at 03:54
  • and after that audited 273 packages . found 0 vulnerabilities – Anjaney Rai May 19 '20 at 03:55
  • it is in the list when running without global i.e npm list --depth=0 – Anjaney Rai May 19 '20 at 03:58
  • If You have installed CLI locally, You may execute it as `./node_modules/@angular/cli/bin/ng new my-dream-app`. As for the installing packages globally, I suggest to check - https://docs.npmjs.com/downloading-and-installing-packages-globally – Viktor Gusev May 19 '20 at 06:09
  • I executed C:\Users\user\node_modules\@angular\cli\bin\ng new filename but it says it is not recognized as internal or external command – Anjaney Rai May 19 '20 at 06:32
  • The command I wrote must be executed from the same directory as `npm list--depth=0`. Earlier You have mentioned that it shows @angular/cli as installed. Also, You may check this [thread](https://stackoverflow.com/questions/33819757/global-npm-install-location-on-windows/43398997) – Viktor Gusev May 19 '20 at 06:39
  • You may try an alternative way: 1. create new directory; 2. run `npm init --yes`; 3. open `package.json`;4. in `scipts` section create new script "ng": "ng"; 5. use `ng` as `npm run ng new projectname` – Viktor Gusev May 19 '20 at 07:04