2014-02-26 44 views
4

2天前,我做的每個全球安裝,模塊都被放入/opt/node/lib/node_modules。突然之間,每一個新的全球安裝被扔進/usr/lib/node_modules突然NPM開始全局安裝到/ usr/lib/node_modules中,爲什麼要從?

該行爲從何而來?我在任何地方都沒有.npmrc文件,在Debian上運行。我可以做什麼來檢索「舊」行爲(安裝在/ opt/node/lib/node_modules中)

另外,當我製作npm list時,它只返回/ usr/lib ...中的模塊並省略其他20個模塊我在/ opt/lib中/節點拿到/ ...

我想處理這個的配置方式,感謝

這裏是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)不存在

回答

4

嘗試運行npm config set prefix /opt/node,這應該設置一個適當的路徑到您的配置。

+0

很好地完成了工作,只是更新你的答案,包括一個'sudo'(用於** - g **安裝),我將它標記爲接受的答案;) – DColl

+2

'npm config'不需要sudo 。另外,無論如何,使用sudo進行安裝通常都是不好的做法。 – alex

+0

同意了,但就我的理解而言,需要進行一般安裝 – DColl

相關問題