安装多个npm版本 [英] Installing multiple npm versions

查看:726
本文介绍了安装多个npm版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以为我正在处理的不同项目安装多个版本的 npm ,或者 npm 安装总是全球化? (Windows 10)

Is it possible to install multiple versions of npm for different projects that I am working on or are the npm installations always global? (Windows 10)

还尝试使用 https安装不同的版本://github.com/marcelklehr/nodist 但它似乎只影响节点版本,而不是npm版本。

Are also tried installing different versions with https://github.com/marcelklehr/nodist but it seems to affect only the node version, not the npm version.

或者npm版本确实很重要?我是否可以使用最新的npm版本,即使项目说需求是某个npm版本?

Or does npm version actually matter? Can I just use the newest npm version even when a project says the requirement is a certain npm version?

推荐答案

你可以安装多个 npm 的版本,安装多个版本的节点。为此,您可以使用 nvm-windows 节点的每个不同安装安装不同版本的 npm

You can install multiple versions of npm by installing multiple versions of node. To do this, you can use nvm-windows. Each different installation of node installs a different version of npm

要在项目中使用不同版本的节点 nvm ,您只需切换:

To use a different version of node and nvm in a project, you simple need to switch:

nvm use 5.0

您还可以创建一个 .nvmrc 文件,其中包含项目根目录中的版本号。 nvm 将为该项目使用指定版本的节点

You can also create a .nvmrc file containing the version number in the project root directory. nvm will use the specified version of node for that project.

这篇关于安装多个npm版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆