nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node doesn't initialize until "nvm use ..." is ran

xenos1337 opened this issue · comments

Operating system and version:

Ubuntu 22.04.4 LTS aarch64

nvm debug output:

nvm --version: v0.39.7
$SHELL: /bin/bash
$SHLVL: 1
whoami: 'root'
${HOME}: /root
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 5.1.16(1)-release (aarch64-unknown-linux-gnu)'
uname -a: 'Linux 5.15.0-97-generic #107-Ubuntu SMP Wed Feb 7 13:27:10 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Ubuntu 22.04.4 LTS
awk: /usr/bin/awk, GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)
curl: /usr/bin/curl, curl 7.81.0 (aarch64-unknown-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.16
wget: /usr/bin/wget, GNU Wget 1.21.2 built on linux-gnu.
git: /usr/bin/git, git version 2.34.1
grep: /usr/bin/grep (grep --color=auto), grep (GNU grep) 3.7
sed: /usr/bin/sed, sed (GNU sed) 4.8
cut: /usr/bin/cut, cut (GNU coreutils) 8.32
basename: /usr/bin/basename, basename (GNU coreutils) 8.32
rm: /usr/bin/rm, rm (GNU coreutils) 8.32
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.32
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.8.0
nvm current: none
which node:
which iojs:
which npm:
npm config get prefix: Command 'npm' not found, but can be installed with:
apt install npm
npm root -g: Command 'npm' not found, but can be installed with:
apt install npm

nvm ls output:

        v20.5.0
default -> 18.6.0 (-> N/A)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v20.5.0) (default)
stable -> 20.5 (-> v20.5.0) (default)
lts/* -> lts/iron (-> 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.21.3 (-> N/A)
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.19.1 (-> N/A)
lts/iron -> v20.11.1 (-> N/A)

How did you install nvm?

using the install.sh script in the readme file

What steps did you perform?

  1. Installed nvm on ubuntu 22.04 (arm)
  2. ran nvm install 20.5.0
  3. logged out
  4. logged back in and ran node -v

What happened?

node doesn't initialize after i logout and login to the server until i run "nvm use 20.5.0"

What did you expect to happen?

that node/npm initializes

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

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

bump

This seems to be because your default is set at node 18, which isn't installed. Try nvm alias default node.