nodist icon indicating copy to clipboard operation
nodist copied to clipboard

Global installed NPM packages are shared between all node versions

Open evangalen opened this issue 9 years ago • 4 comments

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").

evangalen avatar Feb 19 '17 11:02 evangalen

Yes, this is by design, although there are some issues with this feature. Also see the README section on the topic.

marcelklehr avatar Feb 19 '17 12:02 marcelklehr

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

Keyes avatar May 23 '17 07:05 Keyes

I understand. A quick fix might be to create a build task in your package.json and start it using npm run.

marcelklehr avatar May 23 '17 09:05 marcelklehr

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.

marcelklehr avatar May 23 '17 09:05 marcelklehr