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

[Issue]: Loading NVM in Git Bash shell takes 10+ seconds #1103

Closed
lashchev opened this issue Feb 15, 2024 · 1 comment
Closed

[Issue]: Loading NVM in Git Bash shell takes 10+ seconds #1103

lashchev opened this issue Feb 15, 2024 · 1 comment

Comments

@lashchev
Copy link

What happened?

Git Bash from Git for Windows 2.43.0.1 / Win 11

.bash_profile:

TIMEFORMAT='Starting NVM took %R seconds.'
time {
  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
}

Output on session start:
Starting NVM took 10.343 seconds.

What did you expect to happen?

Start time should be sub-second

Version

1.1.11 or newer (Default)

Which version of Windows?

Windows 11+

Which locale?

None

Which shell are you running NVM4W in?

Other

User Permissions?

Standard Use, Non-Elevated

Is Developer Mode enabled?

No (Default)

Relevant log/console output

No response

Debug Output

Running NVM for Windows with administrator privileges.

Administrator: Command Prompt (Admin) - nvm  debug
Windows Version: 10.0 (Build 22631)

NVM4W Version:      1.1.12
NVM4W Path:         C:\Users\<user>\AppData\Roaming\nvm\nvm.exe
NVM4W Settings:     C:\Users\<user>\AppData\Roaming\nvm\settings.txt
NVM_HOME:           C:\Users\<user>\AppData\Roaming\nvm
NVM_SYMLINK:        C:\Program Files\nodejs
Node Installations: C:\Users\<user>\AppData\Roaming\nvm

Total Node.js Versions: 1
Active Node.js Version: v12.22.12

IPv6 is enabled. This can slow downloads significantly.

No problems detected.

Anything else?

No response

@coreybutler
Copy link
Owner

You've got the wrong project. Your code is measuring the startup time for nvm-sh. It even says so in the example code.

Furthermore, nvm-windows doesn't load anything because it's not a shim. When you call node/npm, you're calling node.exe directly. The only time nvm-windows does anything is when you run nvm <command>.

What I suspect you're doing is running nvm-sh in WSL. Perhaps that is trying to launch the WSL environment before it runs nvm... I really don't know. It looks like you ran nvm debug in the standard terminal... so technically you ran one program and produced debugging output for a different program.

I'm closing this because it looks like this is an nvm-sh issue or a WSL issue, not an nvm-windows 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