I am on Windows 10 x64
running PhpStorm 2018.3
. I have updated NodeJS to 10.14.1 which includes NPM 6.4.1.
The Windows command line tool shows the correct versions
PhpStorm settings show the correct versions
The problem I have is that the PhpStorm terminal still shows NPM 3.10.10 although it shows the correct Node version.
I have tried:
This causes trouble because the version of NPM running in my IDE terminal cannot see the globally installed packages.
Global packages from Windows command line
Global packages from PhpStorm terminal
How do I get to the bottom of this?
Running where npm
from the PhpStorm terminal shows that a local dependency has installed the older NPM version
Is it expected for a locally installed NPM to make it impossible for the terminal to see my global packages?
When I run the Windows command line tool from within the project folder, everything works as expected, unlike the PhpStorm terminal. The right version is seen, global packages are seen, and the where
command cannot see the local NPM installed in node_modules
Thanks to Lena for the solution. Turns out that with PhpStorm 2018.3
, a new enabled-by-default setting adds the binaries in the project's local ./node_modules/.bin
to $PATH
, so the terminal would see the locally installed NPM version instead of the global one. To resolve the issue I went to Settings > Tools > Terminal
and unchecked this option:
Add node_modules/.bin from the project root to %PATH%
If anyone involved is reading this, I would suggest allowing the user to add a blacklist of binaries that should not be added when this option is checked.
The problem is caused by Add 'node_modules/.bin' from the project root to $PATH (Settings | Tools | Terminal) - as you have npm
binary in node_modules/.bin
, it's also added to %PATH%
and thus used when running npm
in terminal. Disabling this option should solve the issue