question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

yarn/node execution permission denied

See original GitHub issue

Hi,

We are using frontend-maven-plugin v1.6 on a Bitbucket pipeline using a custom docker image. this issue has appeared only on that environment if I run the maven build locally it does not fail.

These are part of the maven output:

[INFO] Installing node version v9.4.0
[INFO] Downloading https://nodejs.org/dist/v9.4.0/node-v9.4.0-linux-x64.tar.gz to /root/.m2/repository/com/github/eirslett/node/9.4.0/node-9.4.0-linux-x64.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking /root/.m2/repository/com/github/eirslett/node/9.4.0/node-9.4.0-linux-x64.tar.gz into /opt/atlassian/pipelines/agent/build/my-service/web-ui/node/tmp
[INFO] Copying node binary from /opt/atlassian/pipelines/agent/build/my-service/web-ui/node/tmp/node-v9.4.0-linux-x64/bin/node to /opt/atlassian/pipelines/agent/build/my-service/web-ui/node/node
[INFO] Installed node locally.
[INFO] Installing Yarn version v1.8.0
[INFO] Downloading https://github.com/yarnpkg/yarn/releases/download/v1.8.0/yarn-v1.8.0.tar.gz to /root/.m2/repository/com/github/eirslett/yarn/1.8.0/yarn-1.8.0.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
Jul 21, 2018 4:47:48 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: has_recent_activity=1; path=/; expires=Sat, 21 Jul 2018 17:47:48 -0000". Invalid 'expires' attribute: Sat, 21 Jul 2018 17:47:48 -0000
Jul 21, 2018 4:47:48 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Wed, 21 Jul 2038 16:47:48 -0000; secure; HttpOnly". Invalid 'expires' attribute: Wed, 21 Jul 2038 16:47:48 -0000
[INFO] Unpacking /root/.m2/repository/com/github/eirslett/yarn/1.8.0/yarn-1.8.0.tar.gz into /opt/atlassian/pipelines/agent/build/my-service/web-ui/node/yarn
[INFO] Installed Yarn locally.
[INFO] 
[INFO] --- frontend-maven-plugin:1.6:yarn (yarn install) @ my-service ---
[INFO] Running 'yarn install' in /opt/atlassian/pipelines/agent/build/my-service/web-ui
[ERROR] /opt/atlassian/pipelines/agent/build/my-service/web-ui/node/yarn/dist/bin/yarn: exec: line 32: node: Permission denied

and:

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.6:yarn (yarn install) on project my-service: Failed to run task: 'yarn install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 126 (Exit value: 126) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :my-service

I am not sure but I think yarn may need user or group execution permission. This is odd because I think alpine linux uses root directly on its docker images. I am using openjdk:8u121-jdk-alpine to build my docker image to be used on bitbucket pipeline.

thanks in advance,

Martin

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:23

github_iconTop GitHub Comments

1reaction
mhermosicommented, Oct 20, 2018

Hi, I was able to make this work, I am not sure if this may apply to everybody. but debugging my docker image based on alpine I realized that the error is not related with execution permission nor with yarn. it is node distribution itself.

the plugin downloads node distribution which is fine. but in case of alpine linux, not sure if all other Linux images for docker (have not tried) as they are minimal linux distribution, some dependencies (shared libraries) are not available, that is the problem. So how did I overcome this was to create an image including the nodejs / npm distribution from alpine (in my case with node 8.12.0) and match that version with the one used with the plugin. once I did that, the shared libraries were present and the build worked fine.

maybe we should ask the people on node to create a static linked version of their distribution to be used with this library, because finally the plugin itself is not the culprit on this. unfortunately I was not able to find which libraries are missing because alpine does not have ldd and I have not had the time to dig on it to publish a list of missing shared libraries.

The example I saw with pipelines installing yarn and having node-10-alpine I think should work…

1reaction
tubbynlcommented, Aug 21, 2018

ok, after fiddling i discovered that the Jenkinsfile build using install-node-and-yarn did succeed if i use maven:3.5.4 (non-alpine) as build image

the fiddling also included adding -u 0 to the docker run arguments o.0, that works but is so-so

Read more comments on GitHub >

github_iconTop Results From Across the Web

sh: 1: node: Permission denied - Stack Overflow
Got the same error sh: 1: node: Permission denied. So this worked for me npm config set user 0 npm config set unsafe-perm...
Read more >
Yarn Node Manger refused to restart due to permiss... - 278807
Every time when restarting yarn node manager out file will be created with read permission. please find the - 278807.
Read more >
What to do when executing `npm install -g yarn` error - Tuya.com
What to do when executing `npm install -g yarn` error: access denied? ... Replace the command `sudo npm install yarn -g` or refer...
Read more >
Yarn start error: Permission denied - Kibana - Elastic Discuss
js:77:7) at new Cache (user/git/kibana/node_modules/packages/kbn-optimizer/src/node/cache.ts:43:28) at Object.registerNodeAutoTranspilation ( ...
Read more >
FS#54065 : [yarn] permission issue - Arch Linux
Same problem here. /usr/bin/yarn is linking to /usr/lib/node-modules/yarn/bin/yarn.js, which does not have execute permission. I'm not sure if ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found