80
How To Install NPM and Node.js in Jenkins
This article will be a continuation of my previous article (Configuring and Running Jenkins on a Remote Server with Docker).
If you haven't read it, here is the link:
https://dev.to/tomislavkraljic/configuring-and-running-jenkins-on-a-remote-server-with-docker-1cdl
In that tutorial, I went over how to create a remote server on Digital Ocean, configuring, and run Jenkins in a Docker Container on that server.
In this article, I will be teaching you how to install npm and Node.js inside a Jenkins Container. Let's get started!
Step 1: Make sure you remote server is up and running.
Step 2: SSH into your remote server via the command line.
ssh root@<ipv4_address>
Step 3: Grab the container id of Jenkins:
docker ps
Step 4: Enter inside the container that is running Jenkins as root user
docker exec -u 0 -it <container_id> bash
Step 5: Check Linux Distribution running in your Container
cat /etc/issue
Step 6: Update APT
apt-update
Step 7: If not already, install Curl
apt install curl
Step 8: Run curl command to get scripts to install Node.js and NPM
curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
Step 9: Execute script
bash nodesource_setup.sh
Step 10: Install Node.js and NPM
apt install nodejs
Congratulations! You successfully installed NPM and Node.js for Jenkins!
80