'ng' is not recognized as a command

Viewed 56

This question has been posted several times, however, I have not been able to find a solution.

I am using a new computer given to me by my company. node -v = 14.7.3 npm -v = 6.14.13

npm, node, and Angular's location have been added to %PATH%.

Angular has been installed globally.

I have tried to remove package-lock and node_modules and reinstalling using npm.

I have tried to install/uninstall in the projects root, the projects application folder (where node_modules and package-lock is located, and inside the parent of the project as well just to give it a go.

After all of that, I am still receiving the error. I even tried the old turn it off and back on again trick as well.

I am unsure what to try from here. Any assistance would be great!

I am worried that there is some permission I am missing. In order to do anything on my work computer it feels that I need an admin to come and sign in for me or take control and do it for me.

Please let me know any troubleshooting options I have, thank you.

1 Answers

Are you using nvm (or nvm for window)

  • they are used to manage node versions
  • if you install Angular globally under nvm node12, it won't be available on other node versions

Check what node modules are installed globally

  • npm list -g --depth=0

If global Angular isn't available just run the local projects version

  • revert any changes you made to package.json and package-lock.json
  • remove node_modules
  • npm install
  • npm run ng serve -- --port=4200
  • note the extra --, as you're passing down params to a sub command

I'd advise against installing Angular globally anyhow. Look up running angular cli with npm run ng or the equivalent via npx

Related