Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pipelines: Permission Denied on Global NPM Install


Attempting to install a global NPM package, for example @angular/cli, results in a permission denied error.

The pipelines configuration is pretty simple:

image: atlassian/default-image:2pipelines: custom: production: - step: name: Build & Deploy Project deployment: production script: - npm install -g @angular/cli@6.0.0 - npm install -g gulp-cli - cd web/web.cmor - npm install - gulp prod - ng build --prod

The resulting failure reads like this:

npm install -g @angular/cli@6.0.0/root/.nvm/versions/node/v8.9.4/bin/ng -> /root/.nvm/versions/node/v8.9.4/lib/node_modules/@angular/cli/bin/ng> @angular/cli@6.0.0 postinstall /root/.nvm/versions/node/v8.9.4/lib/node_modules/@angular/cli> node ./bin/ng-update-message.jssh: 1: node: Permission deniednpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules/@angular/cli/node_modules/fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})npm ERR! file shnpm ERR! code ELIFECYCLEnpm ERR! errno ENOENTnpm ERR! syscall spawnnpm ERR! @angular/cli@6.0.0 postinstall: `node ./bin/ng-update-message.js`npm ERR! spawn ENOENTnpm ERR! npm ERR! Failed at the @angular/cli@6.0.0 postinstall script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR!     /root/.npm/_logs/2018-05-08T16_23_15_479Z-debug.log

2 answers

The best way I found to install NPM packages globally with Bitbucket Pipelines was to set the user to root:

- npm -g config set user root
- npm install -g packagename


Hi @Justin Ellison,

I had a look around and maybe this article could help?

I'm facing the same error and it has started happening very recently. Any luck @Andrii_Chumak  ?

@Andrii_Chumak I updated the link, could you check again? 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,826 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you