node.js - Add nodejs and npm to Jenkins docker image -
i'm trying quick experiment or 2 jenkins. intended use jenkins image , add nodejs , npm it. here's i'm trying do:
from jenkins user root run curl -sl https://deb.nodesource.com/setup_6.x | bash - \ && apt-get update \ && apt-get install -y \ nodejs run npm install -g npm run npm --version user jenkins the npm --version call fail though, error:
step 5/6 : run npm --version ---> running in 48a250a4fdb8 module.js:471 throw err; ^ error: cannot find module 'process-nextick-args' @ function.module._resolvefilename (module.js:469:15) @ function.module._load (module.js:417:25) @ module.require (module.js:497:17) @ require (internal/module.js:20:19) @ object.<anonymous> (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:26:23) @ module._compile (module.js:570:32) @ object.module._extensions..js (module.js:579:10) @ module.load (module.js:487:32) @ trymoduleload (module.js:446:12) @ function.module._load (module.js:438:3) command '/bin/sh -c npm --version' returned non-zero code: 1 what proper way (if any) fix this?
try following, uses docker multi-stage build copy dependencies 1 image another. allow avoid special things need done install node in docker. there official docker image built docker team, use follows:
from node jenkins user root copy --from=0 /usr/local /usr/local run npm --version user jenkins npm --version output 5.3.0
Comments
Post a Comment