Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvm is not compatible with the npm config prefix option currently set to "" #52

Open
AdrienLemaire opened this issue Jan 17, 2019 · 1 comment

Comments

@AdrienLemaire
Copy link

AdrienLemaire commented Jan 17, 2019

  • Arch linux
  • zsh 5.6.2 with zgen, tmux 2.8
  • nvm v0.34.0 (via zsh-nvm)
  • Deleted system nodejs and npm packages
  • deleted ~/.npmrc and removed nvm sourcing from ~/.zshrc since it's handled by zsh-nvm
  • Had issues with nvm for months so only used system node/npm until recently. Now that latest icu & http-parser libs used by other packages break node 10, I need to constantly downgrade/reupgrade the libs to switch between node 10 & 11, which is too much hassle, so I tried to come back to nvm and spent the morning trying to solve this nvm is not compatible with the npm config "prefix" option: currently set to "" error.
  • Deleted archlinux nvm package, installed zgen load lukechilds/zsh-nvm
$ PATH=".nvm/versions/node/v10.12.0/bin/:$PATH" node
[1]    27252 segmentation fault (core dumped) PATH=".nvm/versions/node/v10.12.0/bin/:$PATH" node  
$ /home/dori/.nvm/versions/node/v10.12.0/bin/node --version
v10.12.0
$ which node
/home/dori/.nvm/versions/node/v10.12.0/bin/node
$ nvm current
none
$ nvm ls
       v10.12.0
default -> v10.12 (-> v10.12.0)
node -> stable (-> v10.12.0) (default)
stable -> 10.12 (-> v10.12.0)

$ nvm use v10.12
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `nvm use --delete-prefix v10.12.0` to unset it.
$ which node
node not found
$ nvm use --delete-prefix v10.12.0
$ which node
/home/dori/.nvm/versions/node/v10.12.0/bin/node
$ node --version
v10.12.0
$ node --help
[1]    19251 segmentation fault (core dumped)  node --help
$ /home/dori/.nvm/versions/node/v10.12.0/bin/node --help                                                    
Usage: node [options] [ -e script | script.js | - ] [arguments]                                             
       node inspect script.js [arguments]                                                                   
                                                                                                            
Options: 

$ npm --version
[1]    28966 segmentation fault (core dumped)  npm --version
$ which npm
/home/dori/.nvm/versions/node/v10.12.0/bin/npm
$  /home/dori/.nvm/versions/node/v10.12.0/bin/npm --version
[1]    5939 segmentation fault (core dumped)  /home/dori/.nvm/versions/node/v10.12.0/bin/npm --version
$ ls -lh  ~/.nvm/versions/node/v10.12.0/bin
total 38M
-rwxr-xr-x 1 dori dori 38M Oct 11 04:53 node
lrwxrwxrwx 1 dori dori  38 Oct 11 04:54 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxrwxrwx 1 dori dori  38 Oct 11 04:54 npx -> ../lib/node_modules/npm/bin/npx-cli.js
$ ls -lh  ~/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm
-rwxr-xr-x 1 dori dori 833 Aug  3 01:58 /home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm
$ vim /home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm # set echo
/home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm --version                             
NODE: node; NPM_CLI_JS: /home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/node_modules/npm/bin/npm-cli.js; @: --version
/home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm: line 35: 31882 Segmentation fault      (core dumped) "$NODE_EXE" "$NPM_CLI_JS" "$@"
$ ls /home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/node_modules/npm/bin/npm-cli.js
ls: cannot access '/home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/node_modules/npm/bin/npm-cli.js': No such file or directory
$ ls /home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm-cli.js
/home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm-cli.js

From this, I understand that NPM_CLI_JS has a duplicated node_modules/npm/bin/ in its path

$ sed -i "s/node_modules\/npm\/bin\///g" /home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm
$ /home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm --version
NODE: node; NPM_CLI_JS: /home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm-cli.js; @: --version
/home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm: line 35: 20130 Segmentation fault      (core dumped) "$NODE_EXE" "$NPM_CLI_JS" "$@"
$ /home/dori/.nvm/versions/node/v10.12.0/bin/node /home/dori/.nvm/versions/node/v10.12.0/lib/node_modules/npm/bin/npm-cli.js --version
6.4.1
$ /home/dori/.nvm/versions/node/v10.12.0/bin/npm --version
[1]    5939 segmentation fault (core dumped)  /home/dori/.nvm/versions/node/v10.12.0/bin/npm --version
$ /usr/bin/env node
[1]    21184 segmentation fault (core dumped)  /usr/bin/env node
/usr/bin/env npm 
[1]    21654 segmentation fault (core dumped)  /usr/bin/env npm

So, the problem is with /usr/bin/env ? I don't know how to debug this further :(

more details
$ nvm debug
nvm --version: v0.34.0
$SHELL: /bin/zsh
$SHLVL: 4
$HOME: /home/dori
$NVM_DIR: '$HOME/.nvm'
$PATH: $NVM_DIR/versions/node/v10.12.0/bin:$HOME/.rvm/gems/ruby-2.5.1/bin:$HOME/.rvm/gems/ruby-2.5.1@global/bin:$HOME/.rvm/rubies/ruby-2.5.1/bin:/opt/google-cloud-sdk/bin:./vendor/bin:node_modules/.bin:$HOME/.pub-cache/bin:$HOME/Projects/personal/flutter/flutter/bin:/opt/genymotion/tools/:$HOME/.cargo/bin:/usr/lib/jvm/java-8-openjdk/jre/bin/:/opt/android-sdk/tools/bin:/opt/android-sdk/emulator:$HOME/.gem/ruby/2.5.0/bin:$HOME/bin:/opt/google-cloud-sdk/bin:./vendor/bin:node_modules/.bin:$HOME/.pub-cache/bin:$HOME/Projects/personal/flutter/flutter/bin:/opt/genymotion/tools/:$HOME/.cargo/bin:/usr/lib/jvm/java-8-openjdk/jre/bin/:/opt/android-sdk/tools/bin:/opt/android-sdk/emulator:$HOME/.gem/ruby/2.5.0/bin:$HOME/bin:$HOME/.rvm/gems/ruby-2.5.1/bin:$HOME/.rvm/gems/ruby-2.5.1@global/bin:$HOME/.rvm/rubies/ruby-2.5.1/bin:/opt/google-cloud-sdk/bin:./vendor/bin:node_modules/.bin:$HOME/.pub-cache/bin:$HOME/Projects/personal/flutter/flutter/bin:/opt/genymotion/tools/:$HOME/.cargo/bin:/usr/lib/jvm/java-8-openjdk/jre/bin/:/opt/android-sdk/tools/bin:/opt/android-sdk/emulator:$HOME/.gem/ruby/2.6.0/bin:$HOME/bin:/opt/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/anaconda/bin/:$HOME/.fzf/bin:$HOME/Projects/3rdpart/phalcon-devtools:$HOME/.rvm/bin:/opt/anaconda/bin/:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/anaconda/bin/:$HOME/Projects/3rdpart/phalcon-devtools              
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.6.2 (x86_64-pc-linux-gnu)'
uname -a: 'Linux 4.20.1-arch1-1-ARCH #1 SMP PREEMPT Wed Jan 9 20:25:43 UTC 2019 x86_64 GNU/Linux'           
OS version: Arch Linux  ()
curl: /usr/bin/curl, curl 7.63.0 (x86_64-pc-linux-gnu) libcurl/7.63.0 OpenSSL/1.1.1a zlib/1.2.11 libidn2/2.1.0 libpsl/0.20.2 (+libidn2/2.1.0) libssh2/1.8.0 nghttp2/1.35.1
wget: /usr/bin/wget, GNU Wget 1.20.1 built on linux-gnu.
git: /usr/bin/git, git version 2.20.1
grep: grep: aliased to grep  --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}), grep (GNU grep) 3.3
awk: /usr/bin/awk, GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.1, GNU MP 6.1.2)
sed: /usr/bin/sed, sed (GNU sed) 4.7
cut: /usr/bin/cut, cut (GNU coreutils) 8.30
basename: /usr/bin/basename, basename (GNU coreutils) 8.30
rm: /usr/bin/rm, rm (GNU coreutils) 8.30
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.30
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.6.0
nvm current: none
which node: $NVM_DIR/versions/node/v10.12.0/bin/node
which iojs: iojs not found
which npm: $NVM_DIR/versions/node/v10.12.0/bin/npm
npm config get prefix: 
npm root -g: 

$ nvm deactivate
/home/dori/.nvm/*/bin removed from $PATH

$ nvm debug
nvm --version: v0.34.0
$SHELL: /bin/zsh
$SHLVL: 4
$HOME: /home/dori
$NVM_DIR: '$HOME/.nvm'
$PATH: $HOME/.rvm/gems/ruby-2.5.1/bin:$HOME/.rvm/gems/ruby-2.5.1@global/bin:$HOME/.rvm/rubies/ruby-2.5.1/bin:/opt/google-cloud-sdk/bin:./vendor/bin:node_modules/.bin:$HOME/.pub-cache/bin:$HOME/Projects/personal/flutter/flutter/bin:/opt/genymotion/tools/:$HOME/.cargo/bin:/usr/lib/jvm/java-8-openjdk/jre/bin/:/opt/android-sdk/tools/bin:/opt/android-sdk/emulator:$HOME/.gem/ruby/2.5.0/bin:$HOME/bin:/opt/google-cloud-sdk/bin:./vendor/bin:node_modules/.bin:$HOME/.pub-cache/bin:$HOME/Projects/personal/flutter/flutter/bin:/opt/genymotion/tools/:$HOME/.cargo/bin:/usr/lib/jvm/java-8-openjdk/jre/bin/:/opt/android-sdk/tools/bin:/opt/android-sdk/emulator:$HOME/.gem/ruby/2.5.0/bin:$HOME/bin:$HOME/.rvm/gems/ruby-2.5.1/bin:$HOME/.rvm/gems/ruby-2.5.1@global/bin:$HOME/.rvm/rubies/ruby-2.5.1/bin:/opt/google-cloud-sdk/bin:./vendor/bin:node_modules/.bin:$HOME/.pub-cache/bin:$HOME/Projects/personal/flutter/flutter/bin:/opt/genymotion/tools/:$HOME/.cargo/bin:/usr/lib/jvm/java-8-openjdk/jre/bin/:/opt/android-sdk/tools/bin:/opt/android-sdk/emulator:$HOME/.gem/ruby/2.6.0/bin:$HOME/bin:/opt/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/anaconda/bin/:$HOME/.fzf/bin:$HOME/Projects/3rdpart/phalcon-devtools:$HOME/.rvm/bin:/opt/anaconda/bin/:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/anaconda/bin/:$HOME/Projects/3rdpart/phalcon-devtools                                                                                                   
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.6.2 (x86_64-pc-linux-gnu)'
uname -a: 'Linux 4.20.1-arch1-1-ARCH #1 SMP PREEMPT Wed Jan 9 20:25:43 UTC 2019 x86_64 GNU/Linux'
OS version: Arch Linux  ()
curl: /usr/bin/curl, curl 7.63.0 (x86_64-pc-linux-gnu) libcurl/7.63.0 OpenSSL/1.1.1a zlib/1.2.11 libidn2/2.1.0 libpsl/0.20.2 (+libidn2/2.1.0) libssh2/1.8.0 nghttp2/1.35.1                                                      
wget: /usr/bin/wget, GNU Wget 1.20.1 built on linux-gnu.
git: /usr/bin/git, git version 2.20.1
grep: grep: aliased to grep  --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}), grep (GNU grep) 3.3                                                                
awk: /usr/bin/awk, GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.1, GNU MP 6.1.2)
sed: /usr/bin/sed, sed (GNU sed) 4.7
cut: /usr/bin/cut, cut (GNU coreutils) 8.30
basename: /usr/bin/basename, basename (GNU coreutils) 8.30
rm: /usr/bin/rm, rm (GNU coreutils) 8.30
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.30
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.6.0
nvm current: none
which node: node not found
which iojs: iojs not found
which npm: npm not found
npm config get prefix: npm may be found in the following packages:
  community/npm
  6.1.0-1
  /usr/bin/npm
  community/npm
  6.1.0-1
  /usr/lib/node_modules/npm/bin/npm
npm root -g: npm may be found in the following packages:
  community/npm
  6.1.0-1
  /usr/bin/npm
  community/npm
  6.1.0-1
  /usr/lib/node_modules/npm/bin/npm

$ echo $PREFIX ; echo $NPM_CONFIG_PREFIX


$ setopt
alwaystoend
autocd
autopushd
noclobber
completeinword
extendedglob
extendedhistory
noflowcontrol
histexpiredupsfirst
histignoredups
histignorespace
histverify
incappendhistory
interactive
interactivecomments
kshglob
login
longlistjobs
monitor
promptsubst
pushdignoredups
pushdminus
sharehistory
shinstdin
zle

Related issues:

@lusoalex
Copy link
Contributor

lusoalex commented May 1, 2020

Hello,
FYI I got the same issue, and fix it (remove nvm from brew and replace it with current plugin) and by checking my $HOME (case sensitive) value.
See my comment here
By the way, as I got the problem installing nvm whether, through the script, zsh plugin, or brew, it's not related to this repo, so you should close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants