npm unable to revert to previous version of node p

2019-08-11 17:32发布

问题:

The current version of the node package angular-cli has a few bugs, so I want to revert to a previous verison: 1.0.0-beta.28.3.

The question is what steps do I need to do to revert to a previous version of a node package.

I run:

npm uninstall angular-cli --save -g 

npm cache clean angular-cli

npm i --save -g angular-cli@1.0.0-beta.21

After doing this, I reinstall and have tried opening a new git console. However, ng --version still returns: version 1.0.0-beta.28.3

回答1:

If you're using Angular CLI beta.28 or less, you need to uninstall angular-cli package. It should be done due to changing of package's name and scope from angular-cli to @angular/cli:

npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli

then clean the cacge and install the new version

npm cache clean
npm i --save -g angular-cli@1.0.0-beta.21