Certified Jenkins Engineer
Setting up CI Pipeline
Demo Install Dependencies
Demo: Install Node.js Dependencies in Your Jenkins Pipeline
In this tutorial, we’ll show you how to integrate a Node.js install step into your Jenkins Pipeline, verify your Node.js version, and install project dependencies. By the end, you’ll see how Blue Ocean displays your pipeline stages and where the node_modules
folder appears in the workspace.
Prerequisites
Note
Make sure the NodeJS Plugin is installed and configured under Manage Jenkins → Global Tool Configuration.
Pipeline Configuration
- Open your
Jenkinsfile
. - Configure the Node.js tool and define two stages:
- VM Node Version: Verifies
node
andnpm
versions. - Installing Dependencies: Runs
npm install --no-audit
.
- VM Node Version: Verifies
Stage Name | Purpose | Command |
---|---|---|
VM Node Version | Check Node.js and npm versions | node -v , npm -v |
Installing Dependencies | Install project dependencies with npm | npm install --no-audit |
pipeline {
agent any
tools {
nodejs 'nodejs-22-6-0'
}
stages {
stage('VM Node Version') {
steps {
sh 'node -v'
sh 'npm -v'
}
}
stage('Installing Dependencies') {
steps {
sh 'npm install --no-audit'
}
}
}
}
Warning
Using --no-audit
skips vulnerability checks. Consider running npm audit
or integrating a security scanner in your CI/CD pipeline for production workloads.
Run the Pipeline
- Commit and push your
Jenkinsfile
changes. - In Blue Ocean, watch the pipeline execute both stages in sequence.
Sample Output for “Installing Dependencies”
+ npm install --no-audit
added 365 packages in 5s
44 packages are looking for funding
run 'npm fund' for details
Verify the Workspace
After the build completes, navigate to Workspaces in the Jenkins UI. You should see a node_modules
directory with all installed dependencies:
Links and References
- Jenkins Pipeline – Official Pipeline documentation
- Node.js – Download and documentation
- Blue Ocean – Modern Jenkins UI
Watch Video
Watch video content