0

I am running in a issue last two days. When I open Vs code and Cmd as admin then only able to run ng commands.

  • Cmd and as admin: ng -v, where ng - Working
  • Vs code terminal as admin: ng build, ng serve - Working
  • Cmd without admin: ng -v, where ng - Not working
  • Vs code terminal without admin: ng build, ng serve - Not working

Getting error

'ng' is not recognized as an internal or external command,
operable program or batch file.

To get admin credentials everytime I need to raise a ticket. Always I dont have admin credentials.

How can I fix this issue?

I have below configuration

Node.js: C:\Program Files\nodejs
npm:     C:\Users\Username\AppData\Roaming\npm

Angular CLI: 9.1.9
Node: 12.15.0

Environment variable in Path

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
C:\Users\Username\AppData\Local\Programs\Microsoft VS Code\bin
C:\Users\Username\AppData\Roaming\npm
C:\Program Files\nodejs
C:\Users\Username\node_modules\.bin
R15
  • 13,982
  • 14
  • 97
  • 173
  • How was nodejs/npm installed? Do you have the same problem with other npm packages? Maybee try installing nodejs/npm without admin rights https://stackoverflow.com/a/37029090/2721865 – kai Jun 24 '20 at 06:10
  • 1
    @kai - Don't know when it was installed. Now I have uninstalled node.js and installed it again. It's working :) Thank you for input. – R15 Jun 24 '20 at 06:35

1 Answers1

3

Fixed by uninstalling and reinstalling node.js (from programs and features) .

R15
  • 13,982
  • 14
  • 97
  • 173