Wrong node version used when running from 'run' (after update to Webstorm 2018) Follow
After updating to Webstorm 2018 my run scripts started to take wrong node version into account.
I have a correct setup in run script configuration but nevertheless they run using the newest global from the system rather than specified there.
When running from terminal everything runs fine. Only run option doesn't work.
Run tries to use 9.x
While I explicitly ask to use 8.2.
Please sign in to leave a comment.
This may be related -- I was having issues running my pre-commit hook because WebStorm does not respect the node version in settings. I set the version to 8.12.0, but the pre-commit hook runs with 10.11.0:
Turns out WebStorm just grabs whatever the default is for the hooks and ignores whatever preference you set.
No, nothing new, it has always worked this way. When being launched from desktop/System menu, WebStorm only sees environment variables configured in
~/.profile(login shell), but not in interactive shell configuration files (like
- Workaround 1: make required variables available in a login shell (i.e. for Zsh, move them from
- Workaround 2: run IDE from a terminal
- Workaround 3: edit the desktop launcher and set command to
/bin/zsh -l -i -c "/path/to/webstorm.sh"
Thank you Leyan Lo. I do the same, though it's not ideal. I have also tried appending `npx nvm use` to the git hook command, considering I have a `.nvmrc` file on the project. Still I can't make the pre-commit hook environment to use proper node version. I'm doing that on a Mac by the way.
Elena Pogorelova do you know if there is any update on this ? Or if there is any YouTrack issue I could subscribe to, in order to receive updates (the issue you've mentioned earlier on the thread is targeting Linux) ?
The problem referred to in https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000160444/comments/360000197819 by Leyan Lo is also happening to me. Didn't find a way to work around it yet...
After a while, I have discovered that what they are saying is true. This is the expected behavior because it's related to the system node version which all the apps use by default. even if you have multiple versions in the system. For me, I solved the issue by removing nodes from the system completely and use nvm to install the appropriate version. You also need to add a symbolic link in /use/bin/node if you encountered some error saying that node can't be found.
We have a ticket for this - https://youtrack.jetbrains.com/issue/IDEABKL-7589; but this is the expected behavior, not a problem with IDE.
Sorry, but Webstorm has never loaded environment variables from interactive shell when being started from desktop/menu. I have no idea why it works for you in previous version
>using yarn, Idea adds the system node version to the path while using npm, the version provided in the dialog is added.
When running npm scripts, IDEA passes
--scripts-prepend-node-pathoption to npm: if it is
passed, the directory within which
noderesides is added to the
PATH. This is done to ensure that all spawned node child processes use the same Node.js version as chosen in run configuration. This flag is not passed to yarn because it has issues with it (it doesn't work in all yarn versions)
>Also happens in OSX High Sierra 10.13.4 when trying to use NVM.I've tried to move nvm initialization from .zshrc to .zprofile to no avail.
this workaround only works on Linux. On Mac, the IDE tries to load terminal environment by executing the following command on startup:
Seems this command can't retrieve all needed stuff in your case - thus the issue.
>Then what's the point in setting the node version in both the run config and project level !!
the IDE can start the specified version when running Node.js apps; but there is no way for the IDE to inject it in the scripts that are used in the calls chain where node is only references by name and resolved from PATH
Tried fresh install but the problem still occurs.
Looks like a
$PATHissue. Sass doesn't use Node.js interpreter set up in your IDE, it uses yarn and node binaries found in
$PATH. Try running WebStorm from terminal using
webstorm.sh- does the issue persist?
Thank you for a quick reply.
Yes, everything works fine when running from terminal.
added into .zshrc and the previous version seemed to be ok with that :)
Something new I have to add/change for 2018?
I've changed the default script:
And seems to work fine. But this is a workaround of an issue. Should I create a ticket in the issue tracker?
How this is not a problem with IDE when if I install an older version of Webstorm everything works fine and when Webstorm 2018 it doesn't work and I have to do some shady workarounds?
All settings, paths in config files etc. are the same - the only change is the version of IDE. One works, other doesn't...
Edit: And yes, I tried downgrading and if I downgrade to last 2017 version everything works fine.
Also happens in OSX High Sierra 10.13.4 when trying to use NVM.
I've tried to move nvm initialization from .zshrc to .zprofile to no avail.
The problems also started after upgrading to Webstorm 2018 after three years with the same exact setup.
I'm using IntelliJ idea on mac OS Mojave. For me, this seems to happen only when using yarn. I added 'echo $PATH;' to a simple script in package.json to verify what gets added to the path and using yarn, Idea adds the system node version to the path while using npm, the version provided in the dialog is added.
Leyan Lo I'm experiencing the exact same issue. Did you find a workaround ?
@Contacto I now commit in a separate terminal, or commit in WebStorm unchecking Run git hooks :-/
At the moment I am also working with git in a separate terminal.
I am subscribing to this thread to find out when this is resolved.
+1 to request fix. Seems to be a problem for IntelliJ as well.
Very crude workaround is to set default node using nvm and restart intellij.
nvm alias default 10
Obviously this requires restarts when switching between projects that use different versions.
Still seeing this in Intelli Ultimate 2020.1. A rare annoyance for sure, workaround for me was to just git cli.
Oksana Chumak can you please check if there are any updates on this?
No updates, this is expected behavior as I wrote above, see https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000160444/comments/360000112470
My workaround to always run phpstorm with the right environment variables:
I modified the Toolbox "Shell scripts location" option from `/home/bertho/bin` to `/usr/bin`
And I created a `/usr/local/bin/phpstorm` (with `chmod +x`):
That's really the expected behavior tho, it'd be easier for me if you wrote that we're marginal users and the priorities for this is too low for even discussing. But you're saying that the behavior is as expected, well, we definitely expected something else, didn't we...?
Think about our use case:
We log into IntelliJ support and turns out we have bad expectations. Yes... That's not a great support experience, to say the least.
That is the exact solution that I used. But, changing the system's node is really a walkaround. I need a different version for different projects, that's exactly the reason, I guess, why IntelliJ has added the ability to change node version, to begin with.
The solution that worked for me was to add my path from terminal to the environment section of the run config.
How is that an expected behavior !! Then what's the point in setting the node version in both the run config and project level !!