将npm降级为旧版本

时间:2023-01-17 09:31:28

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一起安装,所以您应该有一个npm版本。但是,npm比Node更新得更频繁,所以您需要确保它是最新的版本。

npm install npm@latest -g

npm安装npm@latest - g

4 个解决方案

#1


51  

Just replace @latest with 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 npm@3.10.10

#2


9  

Just need to add version of which you want

只需要添加你想要的版本

upgrade or downgrade

升级或降级

npm install -g npm@version

npm安装- g npm@version

Example if you want to downgrade from npm 5.6.0 to 4.6.1 then,

如果你想从npm 5.6.0降级到4.6.1,

npm install -g npm@4.6.1

npm安装- g npm@4.6.1

It is tested on linux

它在linux上测试

#3


1  

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。

#4


0  

Even I run npm install -g npm@4, it is not ok for me.

即使我运行npm安装-g npm@4,也不适合我。

Finally, I download and install the old node.js version.

最后,我下载并安装旧节点。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/

#1


51  

Just replace @latest with 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 npm@3.10.10

#2


9  

Just need to add version of which you want

只需要添加你想要的版本

upgrade or downgrade

升级或降级

npm install -g npm@version

npm安装- g npm@version

Example if you want to downgrade from npm 5.6.0 to 4.6.1 then,

如果你想从npm 5.6.0降级到4.6.1,

npm install -g npm@4.6.1

npm安装- g npm@4.6.1

It is tested on linux

它在linux上测试

#3


1  

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。

#4


0  

Even I run npm install -g npm@4, it is not ok for me.

即使我运行npm安装-g npm@4,也不适合我。

Finally, I download and install the old node.js version.

最后,我下载并安装旧节点。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/