Skip to content

Instantly share code, notes, and snippets.

@lgg
Last active April 13, 2026 12:17
Show Gist options
  • Select an option

  • Save lgg/2cbdadd5253b397f6f0f6ccbedfd183f to your computer and use it in GitHub Desktop.

Select an option

Save lgg/2cbdadd5253b397f6f0f6ccbedfd183f to your computer and use it in GitHub Desktop.
JetBrains intellij idea + NVM + nodejs + WebStorm

NVM + WebStorm

If you get error:

run npm command gives error "/usr/bin/env: node: No such file or directory

in file watcher

solution:

  • edit .bashrc and add export NVM_SYMLINK_CURRENT=true before NVM-stuff
  • then nvm use default
  • Then add $HOME/.nvm/current/bin to your PATH in .profile:
# NVM
if [ -d "$HOME/.nvm/current/bin" ] ; then
    PATH="$HOME/.nvm/current/bin:$PATH"
fi
  • reboot

via JetBrains forum


Solution for Ubuntu 21.04 by @chrisvoo

oriinal comment: https://gist.github.com/lgg/2cbdadd5253b397f6f0f6ccbedfd183f#gistcomment-3803134

For me worked what explained here: in particular, on Ubuntu 21.04, I edited the file ~/.local/share/applications/jetbrains-webstorm.desktop, modifying the Exec item with Exec=/bin/bash -i -c "/home/christian/.local/share/JetBrains/Toolbox/apps/WebStorm/ch-0/211.7442.26/bin/webstorm.sh" %f

@joshuagato

Copy link
Copy Markdown

Thanks a lot. Worked for me too. Saved my day!!

@chrisvoo

chrisvoo commented Jul 5, 2021

Copy link
Copy Markdown

For me worked what explained here: in particular, on Ubuntu 21.04, I edited the file ~/.local/share/applications/jetbrains-webstorm.desktop, modifying the Exec item with Exec=/bin/bash -i -c "/home/christian/.local/share/JetBrains/Toolbox/apps/WebStorm/ch-0/211.7442.26/bin/webstorm.sh" %f

@arthur-mts

Copy link
Copy Markdown

Thanks bro!
And if you installed the web storm desktop shortcut globally (like i did), remember that your .desktop file is in: "/usr/share/applications/jetbrains-webstorm.desktop"

@CyberT33N

Copy link
Copy Markdown

Now if IDE is launched from a terminal, environment variables are loaded correctly. However, environment variables mismatch occurs if IDE is launched from Desktop or System menu. The problem is that IDE sees environment variables configured in ~/.profile (login shell), but not in interactive shell configuration files (like, ~/.bashrc).

The real problem is that some tools alter interactive shell configuration files only during their installation phase. E.g. NVM https://github.com/creationix/nvm/blob/v0.28.0/install.sh#L126

Workaround 1: make required variables available in a login shell (i.e. for Bash, move them from .bashrc to .bash_profile or .profile), then restart X session (logout/login). Workaround 2: run IDE from a terminal Workaround 3: edit IDE desktop launcher and set command to /bin/bash -l -i -c "/path/to/webstorm.sh"

@juliaramosguedes

Copy link
Copy Markdown

worked for me. thanks!

@davedew

davedew commented Feb 4, 2022

Copy link
Copy Markdown

Thanks a lot!

@AlexiGallegos

AlexiGallegos commented Jul 5, 2023 •

Copy link
Copy Markdown

worked for me on phpstorm. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment