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

macOS: Webstorm, Intellij, all Jetbrains Products environment failure from nvm.sh after reboot #2772

Open
0x-2a opened this issue Mar 23, 2022 · 9 comments
Labels
performance This relates to anything regarding the speed of using nvm.

Comments

@0x-2a
Copy link

0x-2a commented Mar 23, 2022

For other users of Jetbrains products, I finally got to the bottom of this annoying message that seems to pop up only after full system reboot (before opening a terminal). After painstakingly going through every line of my .zprofile, .zshrc, .zshenv, commenting, uncommenting, rebooting, I found it... nvm.sh. Of course it's node related!

Screen Shot 2022-03-23 at 9 26 14 AM

It seems something about nvm.sh (permissions, prompts, errors, etc) interferes with Jetbrains shell extension loader due to "interactive shell", see https://youtrack.jetbrains.com/articles/IDEA-A-19/Shell-Environment-Loading.

Trying to fix as suggested by Jetbrains doesn't work through...

# DOES NOT WORK
if [ -z "$INTELLIJ_ENVIRONMENT_READER" ]; then
	[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # <---  problem
	[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  
fi

I've got about 5 hours into finding this bug now -- hopefully someone who knows shell better than me can figure out what in nvm.sh is causing this issue. Reproduce with macOS 12.3, latest nvm freshly curled today, rm -rf node, yarn, all the symlinks, yadda yadda. Also posting on Youtrack so they can point others to comment out nvm.sh loads.

@ljharb
Copy link
Member

ljharb commented Mar 23, 2022

If it’s only happening inside JetBrains products, that suggests it’s not a node or nvm issue, but a jetbrains one. Have you reported it to them?

@0x-2a
Copy link
Author

0x-2a commented Mar 23, 2022

Yep -- and I imagine they'll respond similarly about nvm... c'est la vie

@ljharb
Copy link
Member

ljharb commented Mar 23, 2022

I’d hope not, given that they’re trying to emulate real terminals where it does work :-)

If there’s something i can do to work around the problem, I’m open to it, but i have no idea how to debug it since i don’t use that family of products.

@trespasserw
Copy link

A guy from JetBrains here 👋

Sorry, I have very vague understanding of how nvm.sh works, but most environment loading problems are caused by the command timing out. The question is whether the timeout is permanent (e.g. because of a tool invoked from a shell config file prompts for something) or intermittent (a tool just needs a little bit time). Given the mention of reboot in the issue, it looks rather like the second.

@ljharb
Copy link
Member

ljharb commented Apr 1, 2022

How aggressive is the timeout inside a jetbrains terminal?

@trespasserw
Copy link

At the moment, it is 20 seconds (hardcoded; will be tunable in 2022.1.1+). I have to add that a shell and the helper process are spawned early at the IDE start, which itself is a heavy task.

@JohnAlbin
Copy link

When I get this error (always after restart), I just quit JetBrains and restart it when my Mac has finished its login CPU churn. This is definitely a JetBrains issue, not a nvm one per se.

@JohnAlbin
Copy link

JohnAlbin commented May 3, 2022

Looking in the issue queue, this issue is probably a dupe of #2747 or #2724

@trespasserw
Copy link

Well, in a sane world one wouldn't have to jump through hoops to get the environment.
The problem only happens after reboot, meaning it is a timeout situation - so faster nvm.sh startup would fix it; in this sense it is a duplicate.

@ljharb ljharb added the performance This relates to anything regarding the speed of using nvm. label Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance This relates to anything regarding the speed of using nvm.
Projects
None yet
Development

No branches or pull requests

4 participants