Installed angular-cli globally using (npm install -g angular-cli
) but when I\'m trying to create project using ng new my-project
it is throwing err
According to npm
, the angular-cli
has been renamed to @angular/cli
you can use the following syntax to install it.
npm install -g @angular/cli
In my case, it was happening when I restarted working on an adjacent tab. It was the npm which was not set. Please check the version of npm wither using
npm -v
or if you are having nvm then
nvm list
or
nvm current
I set it to 8.9.1 and then it started working again. I hope it helps.
In my case, I was simply running the wrong node version.
I had just previously installed a new node version to play around with Angular (2).
At work we use 6.x so that is my default in nvm. After restarting the laptop ng
stopped working simply because I was running node 6.x again. So for me it was simply a matter of using the version with which I was installing the Angular CLI:
nvm use node // with the node alias pointing to the right version
or
nvm use v8.11.3 // if you happen to know the version
Check your installed versions and aliases with
nvm list
Same problem here running Windows 10 x64 / NodeJS 6.9.1 / npm 3.10.9.
After installation of Angular CLI via npm:
'ng' command cannot be found
Do the following:
npm uninstall -g npm
npm install -g angular-cli
HTH
Do you install the node js package? https://nodejs.org/en/ Regards
For me (on MacOSX) I had to do:
nvm install stable
npm install -g angular-cli
This installed ng into:
/usr/local/lib/node_modules/@angular/cli/bin/ng
But npm did not put a link to ng into
/usr/local/bin/
Which was why it was not part of the %PATH and therefore available from the command line except via an absolute address.
So I used the following the create a link to ng:
sudo ln -sf /usr/local/lib/node_modules/\@angular/cli/bin/ng /usr/local/bin/ng