Trying to install an npm module:

stage('stage') {

    agent {
        docker {
            image "library/node:alpine"
            args "-u root"
        }
    }
    steps{
        sh 'npm install aws-sam-local -g'
        sh 'sam --help'


I get a permissions error:

> + npm install aws-sam-local -g > aws-sam-local@0.2.11 postinstall 
> /usr/lib/node_modules/aws-sam-local
> > go-npm install 
> /usr/lib/node_modules/aws-sam-local/node_modules/mkdirp/index.js:90
> throw err0;
> ^ Error: EACCES: permission denied, mkdir 
> '/usr/lib/node_modules/aws-sam-local/bin'
> at Object.fs.mkdirSync (fs.js:885:18)
> at Function.sync 
> (/usr/lib/node_modules/aws-sam-local/node_modules/mkdirp/index.js:71:13)
> at Object.install 
> (/usr/lib/node_modules/aws-sam-local/node_modules/go-npm/bin/index.js:161:12)
> at Object.<anonymous> 
> (/usr/lib/node_modules/aws-sam-local/node_modules/go-npm/bin/index.js:212:17)
> at Module._compile (module.js:635:30)
> at Object.Module._extensions..js (module.js:646:10)
> at Module.load (module.js:554:32)
> at tryModuleLoad (module.js:497:12)
> at Function.Module._load (module.js:489:3)
> at Function.Module.runMain (module.js:676:10)
> npm ERR! code ELIFECYCLE
> npm ERR! errno 1
> npm ERR! aws-sam-local@0.2.11 postinstall: `go-npm install`
> npm ERR! Exit status 1
> npm ERR! 
> npm ERR! Failed at the aws-sam-local@0.2.11 postinstall script.
> npm ERR! This is probably not a problem with npm. There is likely 
> additional logging output above.



How can I install a package "globally" in a container slave?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/df8eb5b5-2726-429d-936e-ce8827329de0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to