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.
Tried fresh install but the problem still occurs.
Looks like a
$PATH
issue. 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 usingwebstorm.sh
- does the issue persist?Thank you for a quick reply.
Yes, everything works fine when running from terminal.
I have:
added into .zshrc and the previous version seemed to be ok with that :)
Something new I have to add/change for 2018?
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~/.zshrc
).Possible workarounds:
- Workaround 1: make required variables available in a login shell (i.e. for Zsh, move them from
.zshrc
to.zprofile
).- 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"
I've changed the default script:
to:
And seems to work fine. But this is a workaround of an issue. Should I create a ticket in the issue tracker?
We have a ticket for this - https://youtrack.jetbrains.com/issue/IDEABKL-7589; but this is the expected behavior, not a problem with IDE.
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.
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
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.
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.
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.
>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-path
option to npm: if it ispassed, the directory within which
node
resides is added to thePATH
. 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.
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 :-/
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) ?
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.
+ following
+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.
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...
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