简体   繁体   English

如何为特定版本的Node.js使用不同版本的npm?

[英]How to have a different version of npm for a particular version of Node.js?

If the requirement is to use Node.js v4.x, and npm v3.x, I was able to use 如果要求使用Node.js v4.x和npm v3.x,则可以使用

nvm install --lts=argon

to install Node v4.8.3 LTS. 安装Node v4.8.3 LTS。 But on the Node / npm release page , it says Node v4.8.3 comes with npm 2.15.11. 但是在Node / npm版本页面上 ,它说Node v4.8.3带有npm 2.15.11。 And npm 3.x comes with only Node v5.x. 而且npm 3.x仅带有Nodev5.x。

In this case, how can we make npm v3.x while keeping Node at version 4.x? 在这种情况下,如何使npm v3.x保持Node的版本为4.x?

(and since npm v3.x can be 3.3.6 to 3.10.10, which version should be installed?) (由于npm v3.x可以为3.3.6至3.10.10,应安装哪个版本?)

I think I found the answer. 我想我找到了答案。 It is to use npm install to upgrade itself: 它是使用npm install进行自我升级:

npm install npm@3.10.10 -g

(or any version you want). (或您想要的任何版本)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何基于本地Node.js版本动态安装NPM软件包的特定版本? - How to dynamically install a particular version of a NPM package based on local Node.js version? NPM 模块 canvas 是使用 NODE_MODULE_VERSION 88 针对不同的 Node.js 版本编译的 - NPM module canvas was compiled against a different Node.js version using NODE_MODULE_VERSION 88 如何在具有不同节点版本的服务器上部署 node.js 应用程序 - How to deploy the node.js application on server with different node version Firebase:与此版本的Node.js不兼容的node-tar或npm - Firebase: node-tar or npm that is incompatible with this version of Node.js 使用nvm,是否可以拥有一个版本的Node.js和多个版本的npm? - Using nvm, is it possible to have one version of Node.js and multiple versions of npm? 使用Dockerfile在ubuntu映像中安装特定版本的node.js和npm - Installing specific version of node.js and npm in ubuntu image with Dockerfile 我的node.js程序可以获取npm版本号吗? - Can my node.js program get the npm version number? 在node.js项目中升级(mongodb)npm软件包主要版本 - Upgrading (mongodb) npm package major version in node.js project jhipster:npm抱怨node.js版本 - jhipster: npm complains about node.js version Visual Studio 2015 Node.js工具NPM版本 - Visual Studio 2015 Node.js tools npm version
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM