Suddenly NPM starts installing -globally in / usr / lib / node_modules, why, where?

2 days ago, every global installation I made, the modules were placed in /opt/node/lib/node_modules. Suddenly, every new global installation rushes in /usr/lib/node_modules.

Where could this behavior come from? I don't have a .npmrc file somewhere running on Debian. What can I do to restore the "old" behavior (installed in / opt / node / lib / node_modules)

Also, when I do npm list, it only returns modules in / usr / lib ... and skips 20 other modules that I got in / opt / lib / node / ...

I would like to have a configuration way to handle this, thanks

Here is the result 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"

Global configuration file ( /usr/etc/npmrc) does not exist

+4
1

npm config set prefix /opt/node, .

+4

Source: https://habr.com/ru/post/1529094/


All Articles