0

I have a VS 2015 solution which requires I have the newest version of nodejs installed externally, and added to the External Web Tools path. (web project using a packages.json and gulp file to retrieve css/js modules and compile ssas at build time)

I also have older solutions that uses older versions of modules, and worked with the default versions of npm(1.4.9) and node(0.10.31). Once I installed newer nodejs externally and added to External Web Tools path, npm now throws various errors. As I work through errors I tend to to end up at github issues where someone had opened an issue and the responses were "you're using too old a version of node/npm".

In an ideal world we'd work through the old projects to get them on newer versions but this has a larger impact than is feasible.

Is there a way to specify that some projects use the default node/npm while other projects use the newer? I.e. a way to make the External Web Tools paths a proj/sln level setting instead of being a global Visual Studio setting.

AaronLS
  • 37,329
  • 20
  • 143
  • 202

2 Answers2

0

You can use something like nvm.

In your project root directory, you would setup a .nvmrc and you would just set the version number in there. For example my file would have v10.9.0, and then I would just go into the directory and from the command line type the following:

nvm use

You can also have nvm set your npm version as well. See this answer

mralanlee
  • 479
  • 5
  • 15
  • So if I understand correctly, developers need to run the Windows installer for nvm, install appropriate nodejs versions, and then we could maybe as a pre-build command run `nvm use` in that project and it will change the nodejs symlink based on the `.nvmrc` in that project? – AaronLS Mar 07 '19 at 20:46
0

You can use Node Version Manager(NVM) to solve your problem

NVM allow to run multiple node version in single machine, You can switch on any node verion using NVM

for more information you can refer

https://medium.com/appseed-io/how-to-run-multiple-versions-of-node-js-with-nvm-for-windows-ffbe5c7a2b47