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

init-nvm.sh - slow (mostly while executing "npm") #2251

Closed
kolorafa opened this issue Jul 2, 2020 · 1 comment · Fixed by #2317
Closed

init-nvm.sh - slow (mostly while executing "npm") #2251

kolorafa opened this issue Jul 2, 2020 · 1 comment · Fixed by #2317
Labels
performance

Comments

@kolorafa
Copy link

kolorafa commented Jul 2, 2020

Operating system and version:

nvm debug output:

nvm --version: v0.35.0
$SHELL: /bin/bash
$SHLVL: 1
${HOME}: /home/kolorafa
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v8.17.0/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/opt/COMODO:/opt/cuda/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/lib32/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/opt/xtensa-lx106-elf-gcc/bin:${HOME}/.cargo/bin:${HOME}/.local/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, wersja 5.0.17(1)-release (x86_64-pc-linux-gnu)'
uname -a: 'Linux 5.7.2-arch1-1 #1 SMP PREEMPT Wed, 10 Jun 2020 20:36:24 +0000 x86_64 GNU/Linux'
OS version: Antergos Linux  ()
curl: curl jest /usr/bin/curl, curl 7.70.0 (x86_64-pc-linux-gnu) libcurl/7.70.0 OpenSSL/1.1.1g zlib/1.2.11 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh2/1.9.0 nghttp2/1.41.0
wget: wget jest /usr/bin/wget, GNU Wget 1.20.3 zbudowany na systemie linux-gnu.
ls: nie ma dostępu do 'git': Nie ma takiego pliku ani katalogu
git: git jest /usr/bin/git, git version 2.27.0
ls: nie ma dostępu do 'grep': Nie ma takiego pliku ani katalogu
grep: grep jest aliasem do grep --colour=auto', grep (GNU grep) 3.4
ls: nie ma dostępu do 'awk': Nie ma takiego pliku ani katalogu
awk: awk jest /usr/bin/awk, GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.0.2, GNU MP 6.2.0)
ls: nie ma dostępu do 'sed': Nie ma takiego pliku ani katalogu
sed: sed jest /usr/bin/sed, sed (GNU sed) 4.8
ls: nie ma dostępu do 'cut': Nie ma takiego pliku ani katalogu
cut: cut jest /usr/bin/cut, cut (GNU coreutils) 8.32
ls: nie ma dostępu do 'basename': Nie ma takiego pliku ani katalogu
basename: basename jest /usr/bin/basename, basename (GNU coreutils) 8.32
ls: nie ma dostępu do 'rm': Nie ma takiego pliku ani katalogu
rm: rm jest /usr/bin/rm, rm (GNU coreutils) 8.32
ls: nie ma dostępu do 'mkdir': Nie ma takiego pliku ani katalogu
mkdir: mkdir jest /usr/bin/mkdir, mkdir (GNU coreutils) 8.32
ls: nie ma dostępu do 'xargs': Nie ma takiego pliku ani katalogu
xargs: xargs jest /usr/bin/xargs, xargs (GNU findutils) 4.7.0
nvm current: v8.17.0
which node: ${NVM_DIR}/versions/node/v8.17.0/bin/node
which iojs: which: no iojs in (${NVM_DIR}/versions/node/v8.17.0/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/opt/COMODO:/opt/cuda/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/lib32/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/opt/xtensa-lx106-elf-gcc/bin:${HOME}/.cargo/bin:${HOME}/.local/bin)
which npm: ${NVM_DIR}/versions/node/v8.17.0/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v8.17.0
npm root -g: ${NVM_DIR}/versions/node/v8.17.0/lib/node_modules

nvm ls output:

->      v8.17.0
       v12.16.1
         system
default -> 8 (-> v8.17.0)
node -> stable (-> v12.16.1) (default)
stable -> 12.16 (-> v12.16.1) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/erbium (-> v12.16.1)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0
lts/dubnium -> v10.19.0 (-> N/A)
lts/erbium -> v12.16.1

How did you install nvm?

Arch - nvm AUR

What steps did you perform?

Open new gnome terminal by shortcut

What happened?

Terminal opened but bash didn't show for 20s (when HD was slowed down by copy)
While HD moderatly used - bash show in 1-2s ( https://youtu.be/Ie4Nnml55-g )

While HD was very busy and terminal load in 20s, i used different already open terminal and while doing ps i found that it's stuck at "npm" command:

kolorafa 3024410  0.0  0.0  15844  9960 pts/9    Ss   08:07   0:00  |   \_ bash
kolorafa 3026045  0.0  0.0  13008  4632 pts/9    R+   08:09   0:00  |   |   \_ ps auxf
kolorafa 3025222  0.0  0.0  14364  8504 pts/11   Ss+  08:08   0:00  |   \_ bash
kolorafa 3025440  0.4  0.1 1036508 39904 pts/11  Dl+  08:08   0:00  |   |   \_ npm
kolorafa 3025697  0.1  0.0  14364  8348 pts/13   Ss+  08:09   0:00  |   \_ bash
kolorafa 3025914  0.8  0.1 1036512 40236 pts/13  Dl+  08:09   0:00  |       \_ npm

What did you expect to happen?

NVM loads without slowing down anything ;)

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

Don't think anything related

@ljharb
Copy link
Member

ljharb commented Jul 5, 2020

This is known; nvm use invokes npm config get prefix, which is slow for some users.

At the moment, the workaround is to nvm unalias default, or add --no-use to the sourcing line in your profile files, and then to manually nvm use as needed.

@ljharb ljharb added the performance label Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants