frontend-maven-plugin: yarn/node execution permission denied
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
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 23
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…
ok, after fiddling i discovered that the
Jenkinsfile
build usinginstall-node-and-yarn
did succeed if i usemaven:3.5.4
(non-alpine) as build imagethe fiddling also included adding
-u 0
to the docker run arguments o.0, that works but is so-soi ended up creating a build container having maving+yarn (alpine now has a yarn package) and not using the
install-node-and-yarn