How to run two different node version simultaneously using nvm-windows?

Viewed 1743

Issue: We need to run and use two different node versions i.e 14, 12 simultaneously on two different applications to support the use of npm run dev, npm install commands with defined version accordingly. Steps we have tried so far:

  1. Created .nvmrc file on each application defining the version. This will allow nvm to use the version defined on file i.e nvm use && npm run dev.
  2. Tried with nvm exec command on git bash window.

However, the nvm-windows don't support the exec command and the .nvmrc file (https://github.com/coreybutler/nvm-windows/issues/169). Is there any way to run two different versions of the node simultaneously?

OS: Windows

1 Answers

You can find the binary path to the npm and node when you are on specific node version, by typing:

which node
which npm

and then run the node from its binary path like so (in my pc):

/home/sina/.nvm/versions/node/v14.17.3/bin/node index.js #first project
/home/sina/.nvm/versions/node/v12.22.3/bin/node index.js #second project
Related