Pipelines node 8 broken

Hi, 

 

I am trying to use node version 8.1.2, but I am getting the following erorr 

gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.1.2"

Here is my config 

image: node:8.1.2

pipelines:
  default:
    - step:
        script:
          - cd pipeline
          - apt-get update && apt-get install -y npm libcairo2-dev libjpeg62-turbo-dev libpango1.0-dev libgif-dev build-essential g++
          - npm install --global node-pre-gyp
          - npm install --global @angular/cli
          - npm install && npm cache clean
          - export BRANCH="$BITBUCKET_COMMIT"
          - npm run build-prod
          - chmod +x install.sh && ./install.sh

  branches:
    master:
      - step:
          script:
            - cd pipeline
            - apt-get update && apt-get install -y npm libcairo2-dev libjpeg62-turbo-dev libpango1.0-dev libgif-dev build-essential g++
            - npm install --global node-pre-gyp
            - npm install --global @angular/cli
            - npm install && npm cache clean
            - export BRANCH="latest"
            - npm run build-prod
            - chmod +x install.sh && ./install.sh

options:
  docker: true

If anyone can help that would be much appricated.

2 answers

0 votes
Joshua Tjhin Atlassian Team Jun 27, 2017

At what command does your build fail at?

I've added the log 

Building: /usr/local/bin/node /usr/local/lib/node_modules/@angular/cli/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli   '/usr/local/lib/node_modules/@angular/cli/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.6.2
gyp info using node@8.1.2 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import platform; print(platform.python_version());"` returned: "2.7.9\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.1.2
gyp verb command install [ '8.1.2' ]
gyp verb install input version string "8.1.2"
gyp verb install installing version: 8.1.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp WARN EACCES user "undefined" does not have permission to access the dev dir "/root/.node-gyp/8.1.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.1.2' ]
gyp verb install input version string "8.1.2"
gyp verb install installing version: 8.1.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.2
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.1.2
gyp WARN EACCES user "undefined" does not have permission to access the dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.1.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.1.2' ]

There was a bug introduced to npm 5. @Ergun Polat I've found three potential work arounds for you.

1. Use a node:7.* image. (This uses npm 4.x)

2. Running "npm install @angular/cli" (without --global) before running it again with the global flag seems to also work.

3. Upgrade the npm version to at least 5.1.0.

The issue is with npm version 5.0.x. This is the issue to follow:

https://github.com/npm/npm/issues/16766

Which is referenced by:

https://github.com/nodejs/docker-node/issues/423

https://github.com/nodejs/docker-node/issues/424

This issue should be fixed in npm 5.1.0 (the node docker image is still on npm 5.0.3). :)

Fix: https://github.com/npm/npm/commit/58be2ec596dfb0353ad2570e6750e408339f1478

Release: https://github.com/npm/npm/releases/tag/v5.1.0

@Philip Hodder Thanks for providing me these solution. Option 1 is our current solution. We will wait for the node docker image release of 5.1.0 before moving to node8. Thanks

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

662 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot