Currently I met one problem about Jenkins.
The ex-projects are using Angular 4 with node version 8.
The new project is using Angular 8 with node version 12.
Is there any way to config multiple node version on Jenkins?
THe NodeJS plugin should allow you to declare multiple NodeJS installation in the global settings
I recommend you to install nvm by default on your agents and edit the version you want to use by a simple command :
nvm use 12.4
Why?
Because installing a Jenkins plugin requires maintenance and I personally ended up with the above solution because it's more flexible and you have more control.
How to install nvm
You can use Nvm Wrapper Plugin to manage Node version with diff projects.
https://wiki.jenkins.io/display/JENKINS/Nvm+Wrapper+Plugin
Related
I want to downgrade the NodeJs version to 16 as some of the dependencies I am using in my React app do not support NodeJs 17. I tried this method (another post on stack overflow) also but this thing is not getting installed on my PC.
OS: Windows
Any sort of help is appreciated.
Thanks in advance.
You can use Node Version Manager(NVM).where you can downgrade or upgrade any node version. Please check
https://github.com/nvm-sh/nvm
Windows:
https://dev.to/skaytech/how-to-install-node-version-manager-nvm-for-windows-10-4nbi
Ubuntu:
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04
Clearing the local installation of node, to find out where is and delete
where node
Install nvm
For Windows
For others
Show all the versions
nvm ls available
Install what you want
nvm install 16.11.0
nvm use 16.11.0
Check node version
node -v
I have tried several ways and this works, hope it helps.
2022 update with examples
Install nvm (See link readme: Windows uses installer, Linux has a CLI copy+paste bash script).
Restart the shell (if it was open when installed) to register the new path.
If you want 14.18.1, for example: nvm use 14.18.1
If you don't have it installed, it'll let you know. In that case: nvm install 14.8.1 -> repeat #3.
node -v to verify.
Nodejs.org has previous releases versions in their distribution directory. Find the node version you need and install it.
https://nodejs.org/dist/
n is the simplest package to manage your node versions.
https://www.npmjs.com/package/n
I am building a sample application in which I need to use Node Version v9.11.2 and npm 4.0.0. Currently I have Node Version v16.4.0 installed on my system. I tried to install the specific version by uninstalling the latest version and installing version 9.11.2 from official website
Problem: The problem is I can uninstall the latest version without any problem but when I try to install older version(9.11.2) the command gets opened and it does nothing. I also tried to install the older version using cli commands ie. npm install -g node#9.11.2, it installs the version but on checking the version using node -v, it still shows the latest version(16.4.0)
Below are the screenshots for better understanding
Installed version 9.11.2 but showing 16.4.0
Any Solution please ?
Is using docker a possibility? If so you can simply get a docker image of the required version and use if from there.
Another way is to use NVM which is a really useful tool to manage nodejs versions. I'm including their github repo for your convenience:
https://github.com/nvm-sh/nvm
A good option is to use NVM: https://github.com/coreybutler/nvm-windows (Windows) or https://github.com/nvm-sh/nvm (unix, macOS). With NVM you can enable different versions of node on the same machine and switch from one to another, usually it takes care of managing the installed packages and adding them to its own management system.
I have two different version of node version installed - 11.6 and 13.6. 13.6v is set in path variable so that is default node. I have a project which needs to be built only using 11.6v. But my ng command is using node 13.6 by default (I checked this using ng --version). Is there anyway I can ask ng to use node from a specific folder where I have 11.6 installed instead of the default one.
Edit: This is on Jenkins VM, so I don't have much access to change things.
I think the easiest way to work with different versions is using nvm tool.
See:
https://github.com/nvm-sh/nvm
I had problem with create-react-app and turned out I gotta update my version of nodeJS. The thing is that I can't do so. when I type node --version I get v11.10.0, however when I type sudo n stable, I get:installed : v10.16.3 (with npm 6.9.0).
However when checking version of node I all time get this 11.10.0. How can I get this last stable version 10.16.3?
EDIT: SOLVED
turned out nvm was installed on laptop and it controled node version
I would suggest you use nvm to manage your node versions. It allows you to download multiple versions and you can assign versions on a per project basis. It also allows you to choose which version you want as default
Install nvm it will allow you to install and use any version you want.
Installation steps on ubuntu 18.04
I'm working on two applications. The first one has been migrated to 4.2, the other one still needs to be migrated. So, I'm wondering... is there a way to run two different processes against two diff Node.js binaries? In this case, it would be 4.2 and 0.12.
Yes. If you use nvm (https://github.com/creationix/nvm) you'll be able to do this easily.
Using nvm install both Node.js v4.2 and v0.12:
nvm install 4.2
nvm install 0.12
When you run nvm use <version>, nvm will set the Node.js version to <version> for just that terminal window/tab. So, in one terminal you can run nvm use 4.2 then run your node.js application, and in another terminal window or tab run nvm use 0.12 and run your node.js application that uses v0.12.
If you don't want that terminal window or tab to be scoped to a specific version of Node.js, you can use nvm to just run the server using nvm run <version> <args>. For example:
nvm run 0.12 server.js