-1

I'm very new to angular and i am learning from a project that has been developed some months back.

node v is 12.13.1 npm v is 6.12.1

  • I'm working in windows Operating system.
  • when i tried ng --version or ng -v or ng v it is showing "the term ng is not recognized as the name of a cmdlet in angular".
  • But using npm list -global --depth 0 shows me that @angular/cli@8.3.21.
  • to run the application im using npm start since ng serve is not working.

I tried Updating angularCli by following the steps given in the below link but still the same. https://www.npmjs.com/package/@angular/cli

please help me to solve this issue. Thanks in advance.

Tony
  • 11
  • 1
  • 1
  • 2
  • I guess that is about angularJs @jonrsharpe – Tony Dec 31 '19 at 15:37
  • Why would you guess that? `@angular` and the `ng` CLI command is [tag:angular], not [tag:angularjs]. – jonrsharpe Dec 31 '19 at 15:38
  • i tried that but it needs admin access which i dont have.. is there any possible way to look into this @jonrsharpe..thank you for ur effort. – Tony Dec 31 '19 at 15:47
  • As you've seen, it works if you use `npm` to activate `ng` via the scripts in `package.json`. If you have a script like `"ng": "ng"`, then e.g. `npm run ng -- --version` should work. – jonrsharpe Dec 31 '19 at 15:52

1 Answers1

1

Open Node JS command Prompt

First uninstall angular cli globally

npm uninstall -g @angular/cli

npm cache clean --force

Install latest angular cli

npm install -g @angular/cli

You will be able to access ng variable in Node JS command prompt only. If you are using any other terminal such as windows CMD or bash ng command will not work. To make it work you need to set npm environment variables. To set environment variables you need admin access.

prathameshk73
  • 1,048
  • 1
  • 5
  • 16