Reputation: 408
I work on two different projects. One is using AngularJS, and the packages depend on node v4.2.0. Anything above that node version breaks the application, so basically I am stuck with that version.
Recently I started working on a new application using Angular (6 in particular) and I have installed the latest node version (v8.11.3).
Whenever I switch working on any project during development, I use nvm for windows using the following commands:
nvm use 4.2.0
nvm use 8.11.3
The problem is, when I deploy the applications on the server. How can I run the two applications, at the same time, with different node versions?
Upvotes: 3
Views: 3363
Reputation: 11431
Assuming you are limited to a single server, ideally you would run each application in its own Docker container, keeping node versions isolated.
If this is not an option, you can use the nvm run
command to target specific versions without switching the node variable:
For your angular app:
nvm run 4.2.0 your-angular-app.js
For the other app:
nvm run 8.11.3 your-other-app.js
Upvotes: 3