After updating node my PhpStorm terminal is still showing the older version while my Ubuntu terminal is showing the updated version.
I came across this issue when running npm start and npm install were both failing due to incompatible node version.
After running which node on both terminals I get these results:
/bin/node/usr/local/bin/nodeTrying the top answer to this question didn't work for me: PhpStorm/WebStorm terminal shows old NPM version
The problem is because JetBrains IDEs can alter your $PATH env var when it starts a terminal. Check your settings in your Settings | Tools | Terminal section. There are a few settings that may need to be altered. Look for anything that mentions $PATH:
Add default project PHP interpreter to $PATH - Unless you are purposefully maintaining separate php versions for different projects, you can safely uncheck this. If your PHP interpreter is set to /bin or /usr/bin it could be prepending that to your $PATH and thus overriding /usr/local/bin for your node and npm binaries. If you want to purposefully use a separate php version for a project, I would recommend installing it in a separate directory so as not to conflict with other binaries.
Add 'node_modules/.bin' from the project root to $PATH - If you have npm installed in your node_modules/.bin, then you may want to use it rather than your global npm. However, according to https://youtrack.jetbrains.com/issue/WEB-33571, this setting will now append node_modules/.bin to your $PATH and therefore your global npm will be used. This is probably the desired behavior, but if you do want to use the version from node_modules/.bin, then you'll need to either call it directly (ie. node_modules/.bin/npm start) or add it to your $PATH manually in ~/.bashrc.
(add export PATH="path/to/project/node_modules/.bin:$PATH" to the bottom of your ~/.bashrc file, then restart your terminal or run source ~/.bashrc)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With