nvm
nvm copied to clipboard
allow `npm_config_prefix` (or equivalent) for system node
Operating system and version:
nvm debug output:
nvm --version: v0.39.1
$SHELL: /bin/zsh
$SHLVL: 1
whoami: 'me'
${HOME}: /home/me
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${HOME}/.zinit/polaris/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:${HOME}/bin:${HOME}/.npmbin/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.9 (x86_64-pc-linux-gnu)'
uname -a: 'Linux 5.17.9-arch1-1 #1 SMP PREEMPT Wed, 18 May 2022 17:30:11 +0000 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Arch Linux ()
curl: /usr/bin/curl, curl 7.83.1 (x86_64-pc-linux-gnu) libcurl/7.83.1 OpenSSL/1.1.1o zlib/1.2.12 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.47.0
wget: not found
ls: impossible d'accéder à 'git:': Aucun fichier ou dossier de ce type
git: git: aliased to LC_MESSAGES=C git (LC_MESSAGES=C git), git version 2.36.1
grep: /usr/bin/grep, grep (GNU grep) 3.7
awk: /usr/bin/awk, GNU Awk 5.1.1, API: 3.1 (GNU MPFR 4.1.0-p13, GNU MP 6.2.1)
sed: /usr/bin/sed, sed (GNU sed) 4.8
cut: /usr/bin/cut, cut (GNU coreutils) 9.1
basename: /usr/bin/basename, basename (GNU coreutils) 9.1
rm: /usr/bin/rm, rm (GNU coreutils) 9.1
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 9.1
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.9.0
nvm current: system
which node: /usr/bin/node
which iojs: iojs not found
which npm: /usr/bin/npm
npm config get prefix: ${HOME}/.npmbin
npm root -g: ${HOME}/.npmbin/lib/node_modules
nvm ls output:
v14.17.6
-> system
default -> system
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v14.17.6) (default)
stable -> 14.17 (-> v14.17.6) (default)
lts/* -> lts/gallium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.19.3 (-> N/A)
lts/gallium -> v16.15.0 (-> N/A)
How did you install nvm?
nvm is installed by lukechilds/zsh-nvm (which clones nvm)
What steps did you perform?
- nvm use system
- npm install -g foo
What happened?
error because I am not root
What did you expect to happen?
installation is done somewhere under $HOME
What I have tried
- I exported
npm_config_prefix: this works for system node, but as soon as I try to use nvm, it complains about this env var.
Env vars apply to everything, so there’s no way to make it only apply to the system node. It’s not compatible with nvm.
Either way, prefix should never be used with any node, system or otherwise.