[英]Npm packages are installed in the wrong node version folder of nvm
I have installed node 10.14.2
& node 12.13.1
with nvm
(Node version manage)我已经使用 nvm 安装了
node 10.14.2
和node 12.13.1
nvm
(节点版本管理)
Default version set to node 12.13.1
默认版本设置为
node 12.13.1
This it the output when I run nvm list
当我运行
nvm list
时,这是 output
v10.14.2
-> v12.13.1
system
default -> 12 (-> v12.13.1)
node -> stable (-> v12.13.1) (default)
stable -> 12.13 (-> v12.13.1) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/erbium (-> v12.13.1)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.16.2 (-> N/A)
lts/dubnium -> v10.17.0 (-> N/A)
lts/erbium -> v12.13.1
Now when I install a global npm package, it is installed in the v.10.14.2
folder instead of the v.12.13.1
one, why does it still refer to the old version folder??现在我在安装一个全局的npm package的时候,是安装在
v.10.14.2
文件夹而不是v.12.13.1
的那个文件夹,为什么还是指老版本文件夹??
In my .bash_profile
file I have this if it can help在我的
.bash_profile
文件中,如果有帮助的话,我有这个
export NVM_DIR="$HOME/.nvm"
source ~/.nvm/nvm.sh
I had the same problem.我有同样的问题。 I noticed i had a file
~/.npmrc
which had one line in it...我注意到我有一个文件
~/.npmrc
里面有一行......
prefix=/Users/spoogaloo/.nvm/versions/node/v12.16.1
This was the folder all my global node modules were being installed into, whichever version of node i had selected using nvm.这是我的所有全局节点模块都安装到的文件夹,无论我使用 nvm 选择了哪个版本的节点。
I deleted this file, opened a new terminal and the problem was fixed – new global node modules were installing into their correct folders, according to nvm's current node version.我删除了这个文件,打开了一个新的终端,问题得到了解决——新的全局节点模块正在安装到它们正确的文件夹中,根据 nvm 的当前节点版本。
I think it's because i had previously installed node
using homebrew, and hadn't uninstalled it properly before installing nvm
.我认为这是因为我之前使用自制软件安装了
node
,并且在安装nvm
之前没有正确卸载它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.