Docker Community Forums

Share and learn in the Docker community.

Npm: not found in jenkins pipeline

docker

(Kailashj) #1

I am running Jenkins on Docker … I have one web application having backend Java and frontend some javascript. To automate the build process I need to build the javascript app from the front end. To do so I need npm to install bower, grunt etc.

But when I am trying to add sh “npm install”, it gives me npm:not found error. I have already enabled npm and nodejs plugin from plugin manager.

Is there a better way to do this ?


(Sam) #2

what image are you starting with?


(Kailashj) #3

I have pull jenkins:latest and then done configuration for jdk and maven and that seems working fine, I did the same for nodejs but that is not working


(Sam) #4

npm is not installed on that image… so you will have to do that 1st…

also, that image is deprecated, and you should use jenkins/jenkins:lts

jenkins/jenkins:lts uses apt-get to install new packages.

see the doc here https://hub.docker.com/r/jenkins/jenkins/


(Kailashj) #5

Thank you , that worked like a champ