gpt4 book ai didi

debian - 突然 NPM 开始全局安装到/usr/lib/node_modules 中,为什么,从哪里安装?

转载 作者:行者123 更新时间:2023-12-02 07:04:29 25 4
gpt4 key购买 nike

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

最佳答案

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

关于debian - 突然 NPM 开始全局安装到/usr/lib/node_modules 中,为什么,从哪里安装?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22055703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com