Global installed NPM packages are shared between all node versions
I noticed that when installing NPM packages globally, they are shared between all installed Node.js version.
For instance, I did a npm install -g yarn and noticed that after switching to another Node.js version (using nodist env ..) that yarn was also available when using another Node.js version.
I noticed that the prefix used by Node.js doesn't appear to be related to the active Node.js version
When running npm config list, the "prefix" (under "environment configs") was "C:\Program Files (x86)\Nodist\bin" instead of something Node.js version specific like "C:\Program Files (x86)\Nodist\v-x64\6.9.5").
Yes, this is by design, although there are some issues with this feature. Also see the README section on the topic.
nodist is not usable with global NPM packages for me - grunt for example is always run with node 7, although the current folder requires node 4
I understand. A quick fix might be to create a build task in your package.json and start it using npm run.
A real solution would involve detecting whether the target file is in the global modules folder and using the cwd instead of the target dir in that case.