nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
MIT License
79.76k stars 7.98k forks source link

nvm install doesn't work with any node version #2262

Closed SebastianMG92 closed 4 years ago

SebastianMG92 commented 4 years ago

Operating system and version:

Windows 10 - WSL Ubuntu 18.04

nvm debug output:

``` nvm --version: v0.35.3 $SHELL: /bin/bash $SHLVL: 2 ${HOME}: /home/smarin ${NVM_DIR}: '${HOME}/.nvm' ${PATH}: ~/.npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/smarin/AppData/Roaming/nvm:/mnt/c/Program Files/nodejs:/mnt/c/Users/smarin/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/smarin/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/smarin/AppData/Local/hyper/app-3.0.2/resources/bin:/mnt/c/Users/smarin/AppData/Roaming/nvm:/mnt/c/Program Files/nodejs:/snap/bin $PREFIX: '' ${NPM_CONFIG_PREFIX}: '' $NVM_NODEJS_ORG_MIRROR: '' $NVM_IOJS_ORG_MIRROR: '' shell version: 'GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)' uname -a: 'Linux 4.4.0-19041-Microsoft #1-Microsoft Fri Dec 06 14:06:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux' OS version: Ubuntu 18.04.4 LTS curl: /usr/bin/curl, curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3 wget: /usr/bin/wget, GNU Wget 1.19.4 built on linux-gnu. git: /usr/bin/git, git version 2.17.1 ls: cannot access 'grep:': No such file or directory grep: grep: aliased to grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}), grep (GNU grep) 3.1 awk: /usr/bin/awk, GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2) sed: /bin/sed, sed (GNU sed) 4.4 cut: /usr/bin/cut, cut (GNU coreutils) 8.28 basename: /usr/bin/basename, basename (GNU coreutils) 8.28 rm: /bin/rm, rm (GNU coreutils) 8.28 mkdir: /bin/mkdir, mkdir (GNU coreutils) 8.28 xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0-git nvm current: none which node: node not found which iojs: iojs not found which npm: npm not found npm config get prefix: nvm:199: command not found: npm npm root -g: nvm:199: command not found: npm ```

nvm ls output:

``` v8.0.0 iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v8.0.0) (default) stable -> 8.0 (-> v8.0.0) (default) lts/* -> lts/erbium (-> 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.21.0 (-> N/A) lts/erbium -> v12.18.2 (-> N/A) ```

What happened?

When I tried install any version of node at the end of the process it show

"nvm: install v8.0.0 failed!"

What did you expect to happen?

Then when I tried to set "nvm use v8.0.0" show this

"N/A: version "v8.0.0 -> N/A" is not yet installed.
You need to run "nvm install v8.0.0" to install it before using it."

Is there anything in any of your profile files that modifies the PATH?

My .zshrc file:

``` # If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH export PATH="~/.npm-global/bin:$PATH" # Path to your oh-my-zsh installation. export ZSH="/home/smarin/.oh-my-zsh" # Set name of the theme to load --- if set to "random", it will # load a random theme each time oh-my-zsh is loaded, in which case, # to know which specific one was loaded, run: echo $RANDOM_THEME # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes ZSH_THEME="robbyrussell" # Set list of themes to pick from when loading at random # Setting this variable when ZSH_THEME=random will cause zsh to load # a theme from this variable instead of looking in $ZSH/themes/ # If set to an empty array, this variable will have no effect. # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" # Uncomment the following line to use hyphen-insensitive completion. # Case-sensitive completion must be off. _ and - will be interchangeable. # HYPHEN_INSENSITIVE="true" # Uncomment the following line to disable bi-weekly auto-update checks. # DISABLE_AUTO_UPDATE="true" # Uncomment the following line to automatically update without prompting. # DISABLE_UPDATE_PROMPT="true" # Uncomment the following line to change how often to auto-update (in days). # export UPDATE_ZSH_DAYS=13 # Uncomment the following line if pasting URLs and other text is messed up. # DISABLE_MAGIC_FUNCTIONS="true" # Uncomment the following line to disable colors in ls. # DISABLE_LS_COLORS="true" # Uncomment the following line to disable auto-setting terminal title. # DISABLE_AUTO_TITLE="true" # Uncomment the following line to enable command auto-correction. # ENABLE_CORRECTION="true" # Uncomment the following line to display red dots whilst waiting for completion. # COMPLETION_WAITING_DOTS="true" # Uncomment the following line if you want to disable marking untracked files # under VCS as dirty. This makes repository status check for large repositories # much, much faster. # DISABLE_UNTRACKED_FILES_DIRTY="true" # Uncomment the following line if you want to change the command execution time # stamp shown in the history command output. # You can set one of the optional three formats: # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" # or set a custom format using the strftime function format specifications, # see 'man strftime' for details. # HIST_STAMPS="mm/dd/yyyy" # Would you like to use another custom folder than $ZSH/custom? # ZSH_CUSTOM=/path/to/new-custom-folder # Which plugins would you like to load? # Standard plugins can be found in $ZSH/plugins/ # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=(git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm) source $ZSH/oh-my-zsh.sh # User configuration # export MANPATH="/usr/local/man:$MANPATH" # You may need to manually set your language environment # export LANG=en_US.UTF-8 # Preferred editor for local and remote sessions # if [[ -n $SSH_CONNECTION ]]; then # export EDITOR='vim' # else # export EDITOR='mvim' # fi # Compilation flags # export ARCHFLAGS="-arch x86_64" # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder. # For a full list of active aliases, run `alias`. # # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm ```
ljharb commented 4 years ago

The npm-global dir will break with nvm; global modules cant be shared across node versions.

If you comment that out, what is the full output of nvm use node?

SebastianMG92 commented 4 years ago

Ok, I commented the npm-global line

# export PATH="~/.npm-global/bin:$PATH"

But the result is the same

nvm: install v12.18.2 failed!
nvm use v12.18.2 
N/A: version "v12.18.2 -> N/A" is not yet installed.
You need to run "nvm install v12.18.2" to install it before using it.

By the way, the process takes a long time and show me multiple lines like this


g++ -o /home/smarin/.nvm/.cache/src/node-v12.18.2/files/out/Release/obj.target/libnode/src/stream_wrap.o ../src/stream_wrap.cc '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNODE_ARCH="x64"' '-DNODE_PLATFORM="linux"' '-DNODE_WANT_INTERNALS=1' '-DV8_DEPRECATION_WARNINGS=1' '-DNODE_OPENSSL_SYSTEM_CERT_PATH=""' '-DHAVE_INSPECTOR=1' '-DNODE_ENABLE_LARGE_CODE_PAGES=1' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' '-DNODE_HAVE_SMALL_ICU=1' '-DHAVE_OPENSSL=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' '-DHTTP_PARSER_STRICT=0' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_POSIX_C_SOURCE=200112' '-DNGHTTP2_STATICLIB' -I../src -I/home/smarin/.nvm/.cache/src/node-v12.18.2/files/out/Release/obj/gen -I/home/smarin/.nvm/.cache/src/node-v12.18.2/files/out/Release/obj/gen/include -I/home/smarin/.nvm/.cache/src/node-v12.18.2/files/out/Release/obj/gen/src -I../deps/histogram/src -I../deps/uvwasi/include -I../deps/v8/include -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -I../deps/zlib -I../deps/http_parser -I../deps/llhttp/include -I../deps/cares/include -I../deps/uv/include -I../deps/nghttp2/lib/includes -I../deps/brotli/c/include -I../deps/openssl/openssl/include  -Wall -Wextra -Wno-unused-parameter -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /home/smarin/.nvm/.cache/src/node-v12.18.2/files/out/Release/.deps//home/smarin/.nvm/.cache/src/node-v12.18.2/files/out/Release/obj.target/libnode/src/stream_wrap.o.d.raw   -c

And the .nvm/versions folder, each version only have 3 files

LICENSE CHANGELOG.md README.md

ljharb commented 4 years ago

ah, hmm - that suggests it's compiling the node installation, and also that it's failing to do that.

First, run nvm uninstall node until you have no versions installed. Then, run nvm cache clear.

Then, please provide the full output of nvm install node.

SebastianMG92 commented 4 years ago

Ok, I'ts done,

Before that I delete all the versions folders, then I run nvm cache clear and the end run nvm install --lts. This process solved my problem.

Thank you very much for your support Jordan.

ljharb commented 4 years ago

Glad to hear it! Please let me know if it happens again.