Open In App

Continuous Integration For NPM Project in Ubuntu

Last Updated : 30 Mar, 2023
Like Article

In this post, we’ll see how to make a continuous integration pipeline for an npm project in Jenkins. We will be building, testing, and then finally packaging our npm project in Jenkins. You can refer to the this article to know the basics of docker and Jenkins. All these commands and steps are valid for Ubuntu operating system.

Step 1: Firstly, we need to have Jenkins for that we’ll pull the image of Jenkins using the command below.

docker pull jenkins/jenkinsUbuntu

You can get the container id of your image from the docker desktop.

Step 2: Use the below command to start the Jenkins container using the container id. 

docker start determined_newton

Step-3: Use the below command to run the Jenkins image.

docker exec -it -u root determined_newton /bin/bash

Step-4: Now you need to run the following commands inside your container.

apt-get update
apt-get install npm
apt-get install zip

These commands are required to update the container and install node js and zip.

For the steps to set up the basic Jenkins environment by using the admin password and creating the admin user id refer to the this article. After creating a user id you need to log in with your credentials.

Step 5:  Installing the required plugins required for the npm project in the “Manage Jenkins”, under the “Manage plugins” section that is Build Pipeline Plugin and NodeJS.

Step 6: Configure the global configuration for the NodeJS.

First making independent files for build, test, and package then we will integrate all three together thus creating a pipeline.

Pre-Build steps:

Make first build job by clicking on the “New Item” option in the sidebar and giving the name of the item and selecting “Freestyle project” as an npm project.


Under source code management enter the git repository link with “.git” as an extension as shown below:

Execute shell: npm install

After building we get the output in the console.


Execute shell: npm install, npm test

After configuration build the test phase.


Execute shell: npm install, npm run package

Post-build steps: Integration of Build-Test-Package


Building connection to the test file


Building connection to the Package file


Archive the artifact –  **/distribution/*.zip

Specifying zip

Now run all the files build, test and package.

Pipeline creation:

Click on the ‘+’ sign on the home screen to build and configure the pipeline.


Hence Continuous Integration Pipeline for the npm project is made.

Similar Reads

Docker - Continuous Integration
Continuous Integration ( CI ) with Docker improves the productivity of software development. Docker make the applications portable and independent of the system making its environment uniform. Development of the pipelines can be improved with CI technology tools like Jenkins which automates building, testing and packing the applications. In this ar
8 min read
How to call 'npm start' though docker ?
The following article covers how to call npm start through docker. While doing so, we will dockerize a simple React App. Docker is an open-source platform for running, shipping, and managing applications. It allows us to manage our infrastructure in the same way as we manage our applications. It runs the application in a kind of isolated environmen
2 min read
How To Install and Configure Docker in Ubuntu?
Docker is a platform and service-based product which utilizes OS-level virtualization to deliver software in packages called containers. Containers are separated from one another and bundle their own software, libraries, and configuration files. Docker is written in the Go language. Docker can be installed in two versions Docker CE(Community Editio
5 min read
How to Install ""ifconfig"" Command in My Ubuntu Docker Image?
Docker images are templates that include all the code, libraries, dependencies, and runtime required to run an application. They guarantee consistency and portability across several systems, which makes them indispensable in containerized contexts. Docker images make it simple to scale, deploy, and manage applications, which promotes quicker develo
6 min read
How To Dockerize Maven Project? And How Many Ways To Accomplish It?
Docker is an open-source platform that helps developers pack their applications, along with all necessary program files and dependencies, into a single file called a container. The dockerizing application makes it easier to ship it and run it on another operating system with docker installed on it without depending on the operating system. In this
6 min read
ProGeek Cup 2.0 - A Project Competition by GeeksforGeeks
Format of Project Idea NOTE: The below fields are suggestions to organize the content of your project and are optional. You may write your project idea in a way that suits the project. Project Title : Name of project Introduction: Purpose and features of the system, the interfaces of the system, what the system does, the constraints under which it
3 min read
ProGeek Cup 1.0 – A Project Competition by GeeksforGeeks
ProGeek Cup 1.0 - A Project Competition by GeeksforGeeks Congratulations winner teams! Please contact for certificate and prizes. Winner Projects of this Competition are : JamFree (Vaibhav Khandelwal, Divyanshi Mangal & Pranau Kumar Voice Based Email for Visually Challenged (Pronab Mukherjee, Harsh Agarwal & Gaurav Mig
3 min read
The Ultimate Guide to Project Management
In this Project Management course, you will learn about the basics of Project Management, Phases of Project Management, Principles of Project Management, Project Management Process Activities, Phases of the Project Management Lifecycle, Kanban, Six Sigma and Lean Model of Project Management, What Does a Project Manager Do, Best Project Management C
3 min read
Article Tags :