-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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 adds 60 seconds to Ubuntu Bash startup time (Windows 10) #1493
Comments
How did you install |
Also, which profile files do you have present, and do more than one of them refer to |
Hello, Thank you for the reply. I installed NVM the README way using curl. This is from
My home folder consists of
|
@fjeddy try to use export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use # This loads nvm |
Hello @PeterDaveHello Thank you for the response. That change puts me back on track with "instant" access to Ubuntu Bash on start. But node isn't loaded? |
@fjeddy yes, AFAIK the slow part is |
This doesn't solve the issue tho, it's merely a workaround, for me, not a good one, as i work mostly with node. It would just have to enter the command manually all the time and it's just as slow. |
@fjeddy when you're actually using node, what does |
FYI, on my DigitalOcean server:
|
Sorry, eastern holliday.
Not entirely sure what you mean by "using", no Node app is running when this is executed, just node itself. |
@fjeddy right, i mean when 5s is slow, but shouldn't be adding 60 seconds of time. I'm wondering if the usual suspects of slow things won't apply here, because you're using windows. What does |
root@DESKTOP-UFHJF3C:~# set -x; time nvm use
+ nvm use
+ '[' 1 -lt 1 ']'
+ local COMMAND
+ COMMAND=use
+ shift
+ local VERSION
+ local ADDITIONAL_PARAMETERS
+ case $COMMAND in
+ local PROVIDED_VERSION
+ local NVM_USE_SILENT
+ NVM_USE_SILENT=0
+ local NVM_DELETE_PREFIX
+ NVM_DELETE_PREFIX=0
+ local NVM_LTS
+ '[' 0 -ne 0 ']'
+ '[' -n '' ']'
+ '[' -z '' ']'
+ nvm_rc_version
+ export NVM_RC_VERSION=
+ NVM_RC_VERSION=
+ local NVMRC_PATH
++ nvm_find_nvmrc
++ local dir
+++ nvm_find_up .nvmrc
+++ local path
+++ path=/root
+++ '[' /root '!=' '' ']'
+++ '[' '!' -f /root/.nvmrc ']'
+++ path=
+++ '[' '' '!=' '' ']'
+++ nvm_echo ''
+++ command printf '%s\n' ''
++ dir=
++ '[' -e /.nvmrc ']'
+ NVMRC_PATH=
+ '[' -e '' ']'
+ nvm_err 'No .nvmrc file found'
+ nvm_echo 'No .nvmrc file found'
+ command printf '%s\n' 'No .nvmrc file found'
No .nvmrc file found
+ return 1
+ '[' -n '' ']'
+ unset NVM_RC_VERSION
+ '[' -z '' ']'
+ nvm --help
+ '[' 1 -lt 1 ']'
+ local COMMAND
+ COMMAND=--help
+ shift
+ local VERSION
+ local ADDITIONAL_PARAMETERS
+ case $COMMAND in
+ local NVM_IOJS_PREFIX
++ nvm_iojs_prefix
++ nvm_echo iojs
++ command printf '%s\n' iojs
+ NVM_IOJS_PREFIX=iojs
+ local NVM_NODE_PREFIX
++ nvm_node_prefix
++ nvm_echo node
++ command printf '%s\n' node
+ NVM_NODE_PREFIX=node
+ nvm_echo
+ command printf '%s\n' ''
+ nvm_echo 'Node Version Manager'
+ command printf '%s\n' 'Node Version Manager'
Node Version Manager
+ nvm_echo
+ command printf '%s\n' ''
+ nvm_echo 'Note: <version> refers to any version-like string nvm understands. This includes:'
+ command printf '%s\n' 'Note: <version> refers to any version-like string nvm understands. This includes:'
Note: <version> refers to any version-like string nvm understands. This includes:
+ nvm_echo ' - full or partial version numbers, starting with an optional "v" (0.10, v0.1.2, v1)'
+ command printf '%s\n' ' - full or partial version numbers, starting with an optional "v" (0.10, v0.1.2, v1)'
- full or partial version numbers, starting with an optional "v" (0.10, v0.1.2, v1)
+ nvm_echo ' - default (built-in) aliases: node, stable, unstable, iojs, system'
+ command printf '%s\n' ' - default (built-in) aliases: node, stable, unstable, iojs, system'
- default (built-in) aliases: node, stable, unstable, iojs, system
+ nvm_echo ' - custom aliases you define with `nvm alias foo`'
+ command printf '%s\n' ' - custom aliases you define with `nvm alias foo`'
- custom aliases you define with `nvm alias foo`
+ nvm_echo
+ command printf '%s\n' ''
+ nvm_echo ' Any options that produce colorized output should respect the `--no-colors` option.'
+ command printf '%s\n' ' Any options that produce colorized output should respect the `--no-colors` option.'
Any options that produce colorized output should respect the `--no-colors` option.
+ nvm_echo
+ command printf '%s\n' ''
+ nvm_echo Usage:
+ command printf '%s\n' Usage:
Usage:
+ nvm_echo ' nvm --help Show this message'
+ command printf '%s\n' ' nvm --help Show this message'
nvm --help Show this message
+ nvm_echo ' nvm --version Print out the latest released version of nvm'
+ command printf '%s\n' ' nvm --version Print out the latest released version of nvm'
nvm --version Print out the latest released version of nvm
+ nvm_echo ' nvm install [-s] <version> Download and install a <version>, [-s] from source. Uses .nvmrc if available'
+ command printf '%s\n' ' nvm install [-s] <version> Download and install a <version>, [-s] from source. Uses .nvmrc if available'
nvm install [-s] <version> Download and install a <version>, [-s] from source. Uses .nvmrc if available
+ nvm_echo ' --reinstall-packages-from=<version> When installing, reinstall packages installed in <node|iojs|node version number>'
+ command printf '%s\n' ' --reinstall-packages-from=<version> When installing, reinstall packages installed in <node|iojs|node version number>'
--reinstall-packages-from=<version> When installing, reinstall packages installed in <node|iojs|node version number>
+ nvm_echo ' --lts When installing, only select from LTS (long-term support) versions'
+ command printf '%s\n' ' --lts When installing, only select from LTS (long-term support) versions'
--lts When installing, only select from LTS (long-term support) versions
+ nvm_echo ' --lts=<LTS name> When installing, only select from versions for a specific LTS line'
+ command printf '%s\n' ' --lts=<LTS name> When installing, only select from versions for a specific LTS line'
--lts=<LTS name> When installing, only select from versions for a specific LTS line
+ nvm_echo ' nvm uninstall <version> Uninstall a version'
+ command printf '%s\n' ' nvm uninstall <version> Uninstall a version'
nvm uninstall <version> Uninstall a version
+ nvm_echo ' nvm uninstall --lts Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.'
+ command printf '%s\n' ' nvm uninstall --lts Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.'
nvm uninstall --lts Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.
+ nvm_echo ' nvm uninstall --lts=<LTS name> Uninstall using automatic alias for provided LTS line, if available.'
+ command printf '%s\n' ' nvm uninstall --lts=<LTS name> Uninstall using automatic alias for provided LTS line, if available.'
nvm uninstall --lts=<LTS name> Uninstall using automatic alias for provided LTS line, if available.
+ nvm_echo ' nvm use [--silent] <version> Modify PATH to use <version>. Uses .nvmrc if available'
+ command printf '%s\n' ' nvm use [--silent] <version> Modify PATH to use <version>. Uses .nvmrc if available'
nvm use [--silent] <version> Modify PATH to use <version>. Uses .nvmrc if available
+ nvm_echo ' --lts Uses automatic LTS (long-term support) alias `lts/*`, if available.'
+ command printf '%s\n' ' --lts Uses automatic LTS (long-term support) alias `lts/*`, if available.'
--lts Uses automatic LTS (long-term support) alias `lts/*`, if available.
+ nvm_echo ' --lts=<LTS name> Uses automatic alias for provided LTS line, if available.'
+ command printf '%s\n' ' --lts=<LTS name> Uses automatic alias for provided LTS line, if available.'
--lts=<LTS name> Uses automatic alias for provided LTS line, if available.
+ nvm_echo ' nvm exec [--silent] <version> [<command>] Run <command> on <version>. Uses .nvmrc if available'
+ command printf '%s\n' ' nvm exec [--silent] <version> [<command>] Run <command> on <version>. Uses .nvmrc if available'
nvm exec [--silent] <version> [<command>] Run <command> on <version>. Uses .nvmrc if available
+ nvm_echo ' --lts Uses automatic LTS (long-term support) alias `lts/*`, if available.'
+ command printf '%s\n' ' --lts Uses automatic LTS (long-term support) alias `lts/*`, if available.'
--lts Uses automatic LTS (long-term support) alias `lts/*`, if available.
+ nvm_echo ' --lts=<LTS name> Uses automatic alias for provided LTS line, if available.'
+ command printf '%s\n' ' --lts=<LTS name> Uses automatic alias for provided LTS line, if available.'
--lts=<LTS name> Uses automatic alias for provided LTS line, if available.
+ nvm_echo ' nvm run [--silent] <version> [<args>] Run `node` on <version> with <args> as arguments. Uses .nvmrc if available'
+ command printf '%s\n' ' nvm run [--silent] <version> [<args>] Run `node` on <version> with <args> as arguments. Uses .nvmrc if available'
nvm run [--silent] <version> [<args>] Run `node` on <version> with <args> as arguments. Uses .nvmrc if available
+ nvm_echo ' --lts Uses automatic LTS (long-term support) alias `lts/*`, if available.'
+ command printf '%s\n' ' --lts Uses automatic LTS (long-term support) alias `lts/*`, if available.'
--lts Uses automatic LTS (long-term support) alias `lts/*`, if available.
+ nvm_echo ' --lts=<LTS name> Uses automatic alias for provided LTS line, if available.'
+ command printf '%s\n' ' --lts=<LTS name> Uses automatic alias for provided LTS line, if available.'
--lts=<LTS name> Uses automatic alias for provided LTS line, if available.
+ nvm_echo ' nvm current Display currently activated version'
+ command printf '%s\n' ' nvm current Display currently activated version'
nvm current Display currently activated version
+ nvm_echo ' nvm ls List installed versions'
+ command printf '%s\n' ' nvm ls List installed versions'
nvm ls List installed versions
+ nvm_echo ' nvm ls <version> List versions matching a given <version>'
+ command printf '%s\n' ' nvm ls <version> List versions matching a given <version>'
nvm ls <version> List versions matching a given <version>
+ nvm_echo ' nvm ls-remote List remote versions available for install'
+ command printf '%s\n' ' nvm ls-remote List remote versions available for install'
nvm ls-remote List remote versions available for install
+ nvm_echo ' --lts When listing, only show LTS (long-term support) versions'
+ command printf '%s\n' ' --lts When listing, only show LTS (long-term support) versions'
--lts When listing, only show LTS (long-term support) versions
+ nvm_echo ' nvm ls-remote <version> List remote versions available for install, matching a given <version>'
+ command printf '%s\n' ' nvm ls-remote <version> List remote versions available for install, matching a given <version>'
nvm ls-remote <version> List remote versions available for install, matching a given <version>
+ nvm_echo ' --lts When listing, only show LTS (long-term support) versions'
+ command printf '%s\n' ' --lts When listing, only show LTS (long-term support) versions'
--lts When listing, only show LTS (long-term support) versions
+ nvm_echo ' --lts=<LTS name> When listing, only show versions for a specific LTS line'
+ command printf '%s\n' ' --lts=<LTS name> When listing, only show versions for a specific LTS line'
--lts=<LTS name> When listing, only show versions for a specific LTS line
+ nvm_echo ' nvm version <version> Resolve the given description to a single local version'
+ command printf '%s\n' ' nvm version <version> Resolve the given description to a single local version'
nvm version <version> Resolve the given description to a single local version
+ nvm_echo ' nvm version-remote <version> Resolve the given description to a single remote version'
+ command printf '%s\n' ' nvm version-remote <version> Resolve the given description to a single remote version'
nvm version-remote <version> Resolve the given description to a single remote version
+ nvm_echo ' --lts When listing, only select from LTS (long-term support) versions'
+ command printf '%s\n' ' --lts When listing, only select from LTS (long-term support) versions'
--lts When listing, only select from LTS (long-term support) versions
+ nvm_echo ' --lts=<LTS name> When listing, only select from versions for a specific LTS line'
+ command printf '%s\n' ' --lts=<LTS name> When listing, only select from versions for a specific LTS line'
--lts=<LTS name> When listing, only select from versions for a specific LTS line
+ nvm_echo ' nvm deactivate Undo effects of `nvm` on current shell'
+ command printf '%s\n' ' nvm deactivate Undo effects of `nvm` on current shell'
nvm deactivate Undo effects of `nvm` on current shell
+ nvm_echo ' nvm alias [<pattern>] Show all aliases beginning with <pattern>'
+ command printf '%s\n' ' nvm alias [<pattern>] Show all aliases beginning with <pattern>'
nvm alias [<pattern>] Show all aliases beginning with <pattern>
+ nvm_echo ' nvm alias <name> <version> Set an alias named <name> pointing to <version>'
+ command printf '%s\n' ' nvm alias <name> <version> Set an alias named <name> pointing to <version>'
nvm alias <name> <version> Set an alias named <name> pointing to <version>
+ nvm_echo ' nvm unalias <name> Deletes the alias named <name>'
+ command printf '%s\n' ' nvm unalias <name> Deletes the alias named <name>'
nvm unalias <name> Deletes the alias named <name>
+ nvm_echo ' nvm reinstall-packages <version> Reinstall global `npm` packages contained in <version> to current version'
+ command printf '%s\n' ' nvm reinstall-packages <version> Reinstall global `npm` packages contained in <version> to current version'
nvm reinstall-packages <version> Reinstall global `npm` packages contained in <version> to current version
+ nvm_echo ' nvm unload Unload `nvm` from shell'
+ command printf '%s\n' ' nvm unload Unload `nvm` from shell'
nvm unload Unload `nvm` from shell
+ nvm_echo ' nvm which [<version>] Display path to installed node version. Uses .nvmrc if available'
+ command printf '%s\n' ' nvm which [<version>] Display path to installed node version. Uses .nvmrc if available'
nvm which [<version>] Display path to installed node version. Uses .nvmrc if available
+ nvm_echo ' nvm cache dir Display path to the cache directory for nvm'
+ command printf '%s\n' ' nvm cache dir Display path to the cache directory for nvm'
nvm cache dir Display path to the cache directory for nvm
+ nvm_echo ' nvm cache clear Empty cache directory for nvm'
+ command printf '%s\n' ' nvm cache clear Empty cache directory for nvm'
nvm cache clear Empty cache directory for nvm
+ nvm_echo
+ command printf '%s\n' ''
+ nvm_echo Example:
+ command printf '%s\n' Example:
Example:
+ nvm_echo ' nvm install v0.10.32 Install a specific version number'
+ command printf '%s\n' ' nvm install v0.10.32 Install a specific version number'
nvm install v0.10.32 Install a specific version number
+ nvm_echo ' nvm use 0.10 Use the latest available 0.10.x release'
+ command printf '%s\n' ' nvm use 0.10 Use the latest available 0.10.x release'
nvm use 0.10 Use the latest available 0.10.x release
+ nvm_echo ' nvm run 0.10.32 app.js Run app.js using node v0.10.32'
+ command printf '%s\n' ' nvm run 0.10.32 app.js Run app.js using node v0.10.32'
nvm run 0.10.32 app.js Run app.js using node v0.10.32
+ nvm_echo ' nvm exec 0.10.32 node app.js Run `node app.js` with the PATH pointing to node v0.10.32'
+ command printf '%s\n' ' nvm exec 0.10.32 node app.js Run `node app.js` with the PATH pointing to node v0.10.32'
nvm exec 0.10.32 node app.js Run `node app.js` with the PATH pointing to node v0.10.32
+ nvm_echo ' nvm alias default 0.10.32 Set default node version on a shell'
+ command printf '%s\n' ' nvm alias default 0.10.32 Set default node version on a shell'
nvm alias default 0.10.32 Set default node version on a shell
+ nvm_echo
+ command printf '%s\n' ''
+ nvm_echo Note:
+ command printf '%s\n' Note:
Note:
+ nvm_echo ' to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)'
+ command printf '%s\n' ' to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)'
to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)
+ nvm_echo
+ command printf '%s\n' ''
+ return 127
real 0m1.122s
user 0m0.078s
sys 0m0.406s |
@fjeddy that time prints out 1 second, not 60. Can you show the output for when it takes a minute? |
Apparantly not. The command you have provided is just as fast regardless if i have |
The only thing I can think of is if you comment out the lines in your profile (such that it does not run at shell load) and then try to load it manually? |
Takes just as long to load manually as it takes from the profile :/ I just ended up removing nvm in my dev environment and installing Node 6.10.2 directly. Now it's back to normal and Bash starts without hiccups in 1-3 seconds depending on how much resources i use. |
I wonder if that's unique to your system, or if that's something any Windows 10 user will see. Is your drive networked at all, or is your system particularly old? |
Not sure what you mean by "networked", it's a 32 GB EEMc drive hardwired to the computer. As for my system, it's in no way old, the computer is brand new, few months old, but, it's a crappy computer, Acer Revo Build with 2GB RAM and a Celeron(R) J3060 1.6GHz, nothing to brag over, a fan that runs 24/7 and it's really not happy when i run Telegram, Mailbird, Skype, Steam, Atom, Spotify and Photoshop at the same time 😛 Tho, as mentioned earlier, despite my crappy build, then it beats the living shit out of my $5 VPS where NVM works flawlessly, so i kind of expect it to perform just as well on Bash for Ubuntu. |
I would expect so as well; and no other Windows users have complained of this that I'm aware of. |
+1 time nvm use stable
Now using node v7.9.0 (npm v4.2.0)
real 0m6.058s
user 0m0.609s
sys 0m6.125s |
I'm seeing the same thing.. much slower bash start times since installing nvm |
I'm seeing this as well. I put a
Not quite 60 seconds, but probably 7 seconds longer than it should be. I also tried one with the here's the result of the slow nvm use:
Most of it went by pretty quickly, the only things there was a noticable pause was Not sure if this is relevant, but I am using nvm for windows outside of WSL.... I see it listed there in my path. If that one is run, it gets awful confused and npm will blow up doing anything. It doesn't seem to affect running nvm or node/npm inside WSL. Here's commands I ran to get to this point: sudo apt-get autoremove --purge npm node nodejs
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
exit
nvm install --lts
exit
# <-- start new shell, takes 8 seconds
See: https://github.com/davatron5000/can-i-subsystem-it -- nvm note, "Causes slow Bash start times" I may just go the same route as @fjeddy and use node directly without nvm. For my uses, this is more of a "toy" I'd say and there's not a lot of need to switch node versions often. At work though, I do use ubuntu and need to switch versions often... nvm startup isn't noticeable there. |
I'm not sure what you mean about "outside of WSL" - isn't WSL the same as "BashOnWindows"? |
That linked repo says "Disk IO perf is relatively slow. " - if that's just a known problem in BashOnWindows, then since nvm does disk i/o, there's not really anything I can do to fix it. |
Right, WSL=BashOnWindows. Outside WSL means just running cmd.exe in windows. You spin up bash by typing |
I'm seeing this slowdown as well. It takes about 6 seconds. Things like git etc seem performant on windows, so I don't think it's just IO. I have noticed emacs is slower than it should be to load. So it's likely some slow path/syscall being hit or something. Probably not NVM's fault and I could see how this would be hard to debug. |
Just for another data point - I'm seeing this also. Here's my output from
|
I noticed it was taking forever to initalize a session in bash. Turns out that 0.440s out of 0.548s to source this config was NVM's fault. So you can add --no-use to speed thinks up according to nvm-sh/nvm#1493 It WONT load node though. But you can always run nvm use default AFTER the initialization =)
# NODE VERSION MANAGER
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# This loads nvm
Clearly,these lines in |
@arangates I found these lines are slow too (on MacOS)
|
@arangates tried |
@liuderchi Great workaround ...it works 👍 |
Seems to be dramatically faster on the latest stable releases as of today (4-26-2018) windows 10 slow down seems to be only 5 seconds or less now. dont know who did what but thank you! |
This seems to have been fixed; closing. Please file a new issue if you're still seeing perf issues. |
thx, you save my life! |
Hello,
I am not sure if this is an actual issue or not, but i just did a re-format of my computer (Windows 10) and proceeded as normal with the install of Ubuntu Bash.
This is pretty much a stock install of Windows 10 with Ubuntu Bash where NVM and the latest LTS version of Node is installed. For some reason, then NVM is adding up to a minute extra load when opening Bash the first time. It always takes more then 30 seconds but usually close to a minute.
This wasnt a problem at all before the re-format, opening Ubuntu Bash made it available for commands within a second or two, now it's unbearable with a minute wait time before i can use the command line. Tho, i do not remember if i had installed NodeJS trough NVM before the re-format (It is unlikely and i most likely did a apt-get install nodejs).
Removing nvm.sh puts me right back on "instantly available" when Bash is opened.
Similar if not identical to #1277, they talk seconds, while my issue is minutes. Which make me believe that something is fundementally wrong on my end.
The text was updated successfully, but these errors were encountered: