node.js 将 npm 降级到旧版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46415343/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Downgrade npm to an older version
提问by Don Kirkby
I tried updating npm to see if it would solve some dependency problems we were having, and now I want to downgrade to the version the rest of the development team is using. How can I install an older version?
我尝试更新 npm 以查看它是否可以解决我们遇到的一些依赖问题,现在我想降级到开发团队其他成员正在使用的版本。如何安装旧版本?
I updated npm according to the instructions on the installation page:
我根据安装页面上的说明更新了 npm :
Updating npm
Node comes with npm installed so you should have a version of npm. However, npm gets updated more frequently than Node does, so you'll want to make sure it's the latest version.
npm install npm@latest -g
更新 npm
Node 安装了 npm,所以你应该有一个 npm 版本。但是,npm 比 Node 更新得更频繁,因此您需要确保它是最新版本。
npm install npm@latest -g
回答by Don Kirkby
Just replace @latestwith the version number you want to downgrade to. I wanted to downgrade to version 3.10.10, so I used this command:
只需替换@latest为您要降级到的版本号即可。我想降级到 3.10.10 版本,所以我使用了这个命令:
npm install -g [email protected]
If you're not sure which version you should use, look at the version history. For example, you can see that 3.10.10 is the latest version of npm 3.
如果您不确定应该使用哪个版本,请查看版本历史记录。例如,您可以看到 3.10.10 是 npm 3 的最新版本。
回答by Parvinder Kumar
Just need to add version of which you want
只需要添加你想要的版本
upgrade or downgrade
升级或降级
npm install -g npm@version
npm install -g npm@version
Exampleif you want to downgrade from npm 5.6.0 to 4.6.1 then,
例如,如果你想从 npm 5.6.0 降级到 4.6.1,那么,
npm install -g [email protected]
npm install -g [email protected]
It is tested on linux
它是在 linux 上测试的
回答by moyo
npm install -g npm@4
This will install the latest version on the major release 4, no no need to specify version number. Replace 4 with whatever major release you want.
这将在主要版本 4 上安装最新版本,无需指定版本号。将 4 替换为您想要的任何主要版本。
回答by Lakshay Sharma
Before doing that Download Node Js 8.11.3 from the URL: download
在此之前,从 URL 下载 Node Js 8.11.3:下载
Open command prompt and run this:
打开命令提示符并运行:
npm install -g [email protected]
npm install -g [email protected]
use this version this is the stable version which works along with cordova 7.1.0
使用这个版本这是与cordova 7.1.0一起使用的稳定版本
for installing cordova use : ? npm install -g [email protected]
安装cordova使用:?npm install -g [email protected]
? Run command
? 运行命令
? Cordova platform remove android (if you have old android code or code is having some issue)
? Cordova 平台删除 android(如果您有旧的 android 代码或代码有问题)
? Cordova platform add android : for building android app in cordova Running: Corodva run android
? Cordova 平台添加 android:用于在cordova 中构建android 应用程序运行:Corodva run android
回答by Zaw Than oo
Even I run npm install -g npm@4, it is not ok for me.
即使我跑npm install -g npm@4,对我来说也不好。
Finally, I download and install the old node.js version.
最后,我下载并安装了旧的 node.js 版本。
https://nodejs.org/download/release/v7.10.1/
https://nodejs.org/download/release/v7.10.1/
It is npm version 4.
这是 npm 版本 4。
You can choose any version here https://nodejs.org/download/release/
你可以在这里选择任何版本 https://nodejs.org/download/release/

