Earlier this week I started seeing failures on myDocker builds with a rather cryptic message:sh: 1: node: Permission denied
. This was really strange, because I did not change anything significant enough to cause this error. Example of failing logs:
Fornetlify-cli:
Step 17/18 : RUN volta install netlify-cli --verbose ---> Running in 53c120c8aebb[verbose] Acquiring lock on Volta directory: /root/.volta/volta.lock[verbose] Found default configuration at '/root/.volta/tools/user/platform.json'[verbose] node@12.19.0 has already been fetched, skipping download[verbose] yarn@1.22.10 has already been fetched, skipping download[verbose] Installing netlify-cli with command: "npm" "install" "--global" "--loglevel=warn" "--no-update-notifier" "--no-audit" "netlify-cli"[verbose] [install stderr]npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecatednpm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecatednpm WARN deprecated object-keys@0.2.0: Please update to the latest object-keyssh: 1: node: Permission deniednpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/netlify-cli/node_modules/rollup/node_modules/fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})npm WARN @octokit/plugin-request-log@1.0.1 requires a peer of @octokit/core@>=3 but none is installed. You must install peer dependencies yourself.npm ERR! code ELIFECYCLEnpm ERR! syscall spawnnpm ERR! file shnpm ERR! errno ENOENTnpm ERR! netlify-cli@2.65.7 postinstall: `node ./scripts/postinstall.js`npm ERR! spawn ENOENTnpm ERR!npm ERR! Failed at the netlify-cli@2.65.7 postinstall script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Forember-cli:
Step 17/18 : RUN volta install ember-cli netlify-cli --verbose ---> Running in c09e5ec1b6cf[verbose] Acquiring lock on Volta directory: /root/.volta/volta.lock[verbose] Found default configuration at '/root/.volta/tools/user/platform.json'[verbose] node@12.19.0 has already been fetched, skipping download[verbose] yarn@1.22.10 has already been fetched, skipping download[verbose] Installing ember-cli with command: "npm" "install" "--global" "--loglevel=warn" "--no-update-notifier" "--no-audit" "ember-cli"[verbose] [install stderr]npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecatednpm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecatednpm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.sh: 1: node: Permission deniednpm ERR! code ELIFECYCLEnpm ERR! syscall spawnnpm ERR! file shnpm ERR! errno ENOENTnpm ERR! core-js@2.6.11 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`npm ERR! spawn ENOENTnpm ERR! npm ERR! Failed at the core-js@2.6.11 postinstall script.
The error message looks slightly different in each case.
What Ithink is the problem: In myDocker container, I'm usingVolta for node/yarn version management. And for thevolta install
command it internally usesnpm install --global
, which does not like to run when the script is executed asroot.
So the solution was to add following line to myDockerfile just before thevolta install command:
RUN npm set unsafe-perm true
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse