Install nodeJS under Linux and configure it under jenkins

1. Problem

An error is reported when installing nodejs under the jenkins server:

[root@VM-0-12-centos bin]# node -v
node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by node)
node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by node)
node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by node)

insert image description here

2. Find the reason

Installed nodejs version:

node-v18.14.1

Linux system version:

[root@VM-0-12-centos local]# cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)

It is found that the version does not match, and the error can be avoided by reducing the version of nodejs.

3. Install low version nodejs

1) Enter the directory of the Linux server and execute the download, the command is

cd /usr/local/
wget https://nodejs.org/download/release/v16.16.0/node-v16.16.0-linux-x64.tar.gz

2) Decompress the compressed package, command

tar -zxvf node-v16.16.0-linux-x64.tar.xz

3) Rename the folder just unzipped to nodejs

mv node-v16.16.0-linux-x64 nodejs

Wait patiently for the installation, and enter y when prompted;

4) Open the environment variable configuration file, and add nodejs related configuration information at the bottom: The command is

vim /etc/profile
export PATH=$PATH:/usr/local/nodejs/bin

Then save and exit! (i input, esc and then input ":wq")

5) Refresh the environment variables,

source /etc/profile 

6) Enter the command to check the installed nodejs version, if the verification is passed, the installation is successful.

[root@VM-0-12-centos local]# node -v
v16.16.0

4. Configure jenkins server

1) Install the nodejs plugin on jenkins

The picture below is a screenshot of my successful installation
insert image description here

2) Configuration

Go to Manage Jenkins → Global Tool Configuration, find nodejs for configuration
insert image description here

Guess you like

Origin blog.csdn.net/weixin_43466526/article/details/129144125
Recommended