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.js
sh: 1: node: Permission denied
npm 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 sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @angular/cli@6.0.0 postinstall: `node ./bin/ng-update-message.js`
npm ERR! spawn ENOENT
npm 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
The best way I found to install NPM packages globally with Bitbucket Pipelines was to set the user to root:
script:
- npm -g config set user root
- npm install -g packagename
Hi @Justin Ellison,
I had a look around and maybe this article could help? https://github.com/npm/npm/issues/14042
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dead link...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm facing the same error and it has started happening very recently. Any luck @Andrii_Chumak ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Andrii_Chumak I updated the link, could you check again?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.