问题
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.
回答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.
来源:https://stackoverflow.com/questions/59545882/the-term-ng-is-not-recognized-as-the-name-of-a-cmdlet-in-angular