npm 将所有模块安装在/usr/local/lib/node_modules/ [英] npm installs all modules in /usr/local/lib/node_modules/
问题描述
我在 Ubuntu 12.10 上安装了 node.js 0.8.14.我在我的主目录中创建了一个目录,其中包含一个子目录 node_modules
.我想在那里安装一些本地节点模块但正在运行
<代码>npm 安装 myModule在此目录中,将此模块安装在 /usr/local/lib/node_modules/
(与使用 -g
标志安装模块的行为相同
I have node.js 0.8.14 installed on Ubuntu 12.10. I created a directory in my home directory with a sub directory node_modules
. I want to install some local node modules there but running
npm install myModule
in this directory installs this module in /usr/local/lib/node_modules/
(same behavior as installing the module with the -g
flag
.bashrc
中没有节点路径.
知道如何安装本地节点模块吗?
Any idea how I can install local node modules?
推荐答案
经过进一步研究,我找到了解决方案.
After some further research I found the solution.
运行命令 npm config ls
显示默认配置 global=false
(您使用 npm config ls -l
看到默认配置) 被 /home/vsdev/.npmrc
和 /usr/local/etc/npmrc
中的 global=true
覆盖.
Running the command npm config ls
revealed that the default config global=false
(you see the default config with npm config ls -l
) was overwritten by global=true
in /home/vsdev/.npmrc
and /usr/local/etc/npmrc
.
将其恢复为 global=false
解决了问题.
Reverting this to global=false
solved the issue.
这篇关于npm 将所有模块安装在/usr/local/lib/node_modules/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!