突然,NPM开始将-globally安装到/ usr / lib / node_modules中,为什么,从哪里来?

时间:2014-02-26 23:20:50

标签: debian npm

2天前,我所做的每次全局安装都将模块放入/opt/node/lib/node_modules。突然间,每个新的全局安装都被投入/usr/lib/node_modules

这种行为可能来自哪里?我在Debian上运行的任何地方都没有.npmrc文件。我该怎么做才能检索“旧”行为(安装在/ opt / node / lib / node_modules中)

另外,当我创建npm list时,它只返回/ usr / lib中的模块...并省略了我在/ opt / lib / node / ...中的其他20个模块。

我想要一个处理这个的配置方式,谢谢

以下是npm config ls -l

的结果
; cli configs
long = true
registry = "https://registry.npmjs.org/"

; default values
always-auth = false
bin-links = true
browser = null
ca = null
cache = "/root/.npm"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cert = null
color = true
depth = null
description = true
dev = false
editor = "vi"
email = ""
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
force = false
git = "git"
git-tag-version = true
global = false
globalconfig = "/usr/etc/npmrc"
globalignorefile = "/usr/etc/npmignore"
group = "33"
heading = "npm"
https-proxy = null
ignore-scripts = false
init-module = "/root/.npm-init.js"
init.author.email = ""
init.author.name = ""
init.author.url = ""
init.license = "ISC"
json = false
key = null
link = false
local-address = undefined
loglevel = "http"
; long = false (overridden)
message = "%s"
node-version = "v0.10.25"
npat = false
onload-script = false
optional = true
parseable = false
prefix = "/usr"
production = false
proprietary-attribs = true
proxy = null
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = false
save-bundle = false
save-dev = false
save-optional = false
searchexclude = null
searchopts = ""
searchsort = "name"
shell = "/bin/bash"
shrinkwrap = true
sign-git-tag = false
strict-ssl = true
tag = "latest"
tmp = "/root/tmp"
umask = 18
unicode = true
unsafe-perm = false
usage = false
user = 1001
user-agent = "node/v0.10.25 linux arm"
userconfig = "/root/.npmrc"
username = ""
version = false
versions = false
viewer = "man"

全局配置文件(/usr/etc/npmrc)不存在

1 个答案:

答案 0 :(得分:4)

尝试运行npm config set prefix /opt/node,这应该为您的配置设置正确的路径。