Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netlify-cli recently failed to install on CI (docker) #1870

Open
noraj opened this issue Feb 10, 2021 · 14 comments
Open

netlify-cli recently failed to install on CI (docker) #1870

noraj opened this issue Feb 10, 2021 · 14 comments
Labels
area: installation init/es-func-bundle type: bug code to address defects in shipped code

Comments

@noraj
Copy link

noraj commented Feb 10, 2021

Describe the bug

Installing fails on my gitlab CLI but wucess on my dev VM.

$ npm install netlify-cli -g
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
> yarn@1.22.10 preinstall /usr/local/lib/node_modules/netlify-cli/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)
/usr/local/bin/ntl -> /usr/local/lib/node_modules/netlify-cli/bin/run
/usr/local/bin/netlify -> /usr/local/lib/node_modules/netlify-cli/bin/run
> esbuild@0.8.43 postinstall /usr/local/lib/node_modules/netlify-cli/node_modules/esbuild
> node install.js
Trying to install "esbuild-linux-64" using npm
Failed to install "esbuild-linux-64" using npm: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/esbuild-r63cli2pgpi'
Trying to download "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.8.43.tgz"
/usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/install.js:217
      throw e;
      ^
Error: EACCES: permission denied, open '/usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/bin/esbuild'
    at Object.openSync (fs.js:476:3)
    at Object.writeFileSync (fs.js:1467:35)
    at /usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/install.js:66:8
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/install.js:6:24)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/bin/esbuild'
}
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/netlify-cli/node_modules/rollup/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-win32-x64@^0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent/node_modules/@netlify/traffic-mesh-agent-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/traffic-mesh-agent-win32-x64@0.27.10: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-darwin-x64@^0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent/node_modules/@netlify/traffic-mesh-agent-darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/traffic-mesh-agent-darwin-x64@0.27.10: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN @octokit/plugin-request-log@1.0.3 requires a peer of @octokit/core@>=3 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! esbuild@0.8.43 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the esbuild@0.8.43 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/2021-02-10T19_57_41_262Z-debug.log

In the CI it fails on both nodejs 10.23.2 and 14.15.5. On my dev vm works with 12.16.2 and 14.15.5.

It started to happens today, I used the same command on my CI for years with nodejs 10.x.

The esbuild permission access error is weird, the difference I see is that on, my dev VM I install it as an user (with asdf but the CI (dockerized environment) seems to run as root.

To Reproduce

Steps to reproduce the behavior:

  1. Install the last npmjs package globally npm install netlify-cli -g on docker image node:14

Configuration

N/A

npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli

Expected behavior

Install correctly.

CLI Output

See above.

Additional context

N/A

@noraj noraj added the type: bug code to address defects in shipped code label Feb 10, 2021
@noraj noraj changed the title netlify-cli recently failed to install on CI netlify-cli recently failed to install on CI (docker) Feb 10, 2021
@eduardoboucas
Copy link
Member

Hi @noraj. This seems to be a common problem when installing certain packages as root.

Can you please try to install the CLI with npm install --unsafe-perm=true -g netlify-cli? You can read more about the additional flag here.

@linogaliana
Copy link

linogaliana commented Feb 11, 2021

Hi @noraj. This seems to be a common problem when installing certain packages as root.

Can you please try to install the CLI with npm install --unsafe-perm=true -g netlify-cli? You can read more about the additional flag here.

@eduardoboucas Adding --unsafe-perm=true solved the problem in my case (error before and success after)

@eduardoboucas
Copy link
Member

Thanks, @linogaliana! We're exploring different options to avoid requiring this flag, but at least this unblocks people in the meantime.

@noraj
Copy link
Author

noraj commented Feb 11, 2021

The workaround seems to work, until yesterday the unsafe flag was not required. So it must be due to 3.6, 3.7 or 3.7.1 release.

@eduardoboucas
Copy link
Member

The workaround seems to work, until yesterday the unsafe flag was not required. So it must be due to 3.6, 3.7 or 3.7.1 release.

It is due to some changes we've introduced in the last version. We'll be updating this issue with any updates on this topic. Until then, if you must install the CLI under the root user, we recommend that you use the flag.

@tranlehaiquan
Copy link

tranlehaiquan commented Feb 13, 2021

Also, happen to me when I tried to upgrade new version.

Macos: Big sur 11.2

@eduardoboucas
Copy link
Member

@noraj @tranlehaiquan @linogaliana if any of you has a chance to try this on npm 7 without the --unsafe-perms flag, can you please let us know if this issue persists?

Thanks! 🙌🏻

@noraj
Copy link
Author

noraj commented Feb 16, 2021

  • ❌ Node.js 14.15.5, npm 6.14.11, netlify-cli 3.8.3
  • ✅ Node.js 15.8.0, npm 7.5.1, netlify-cli 3.8.3

But it means I had to switch from node 14 LTS to node 15 short live version. I hoped it was possible to with npm 6 too.
Also the netlify installation file is considerably longer now, see my total pipeline execution time:

  • npm 6, netlify-cli before the bug, stable between 4:15 and 4:30
  • npm 6, netlify-cli with the bug and --unsafe-perm=true, 4:51
  • npm 7, netlify-cli patched, 6:38

See default npm version for each nodejs release https://nodejs.org/en/download/releases/

duckinator added a commit to duckinator/versions.do1g.com that referenced this issue Feb 16, 2021
bors bot added a commit to duckinator/versions.do1g.com that referenced this issue Feb 16, 2021
12: Add workaround for netlify/cli#1870. r=duckinator a=duckinator



Co-authored-by: Ellen Marie Dash <me@duckie.co>
@eduardoboucas
Copy link
Member

@noraj thanks for helping us verify this.

That additional installation time is introduced by a bug in npm 7. We have filed an issue with npm and a pull request is underway.

@maxim-lobanov
Copy link

Hello @eduardoboucas , do you have plans to fix this issue for NPM 6?
Node.JS 14 is LTS and has NPM 6.x by default. Updating default NPM to 7 in CI before installing netlify-cli is pretty annoying.

@eduardoboucas
Copy link
Member

eduardoboucas commented Feb 24, 2021

Hi @maxim-lobanov. Our recommendation for getting around this in npm 6 is to use the unsafe-perm flag when installing the CLI, as described in #1870 (comment).

Does that work for you?

@farhan-syed
Copy link

farhan-syed commented Mar 16, 2021

Not sure if this will help with Docker but I had the same exact issue on Ubuntu local machine. Before trying unsafe-perm, I updated node and also npm to the latest versions. Then I tried again to install sudo npm install netlify-cli -g, which worked without issue.

Just thought I would put this here if anyone is looking for an answer.

The versions I updated to:
npm: 7.6.3
node: 14.16.0

@erhanyasar
Copy link

husky > Setting up git hooks
Can't find package.json in /Users/erhanyasar/Documents/Computational/reference/www/erhanyasar.com.tr/express-graphql-portfolio-website-api directory or parents
Please check that your project has a package.json or create one and reinstall husky.
husky > Failed to install

esbuild@0.11.10 postinstall /usr/local/lib/node_modules/netlify-cli/node_modules/esbuild
node install.js

Trying to install "esbuild-darwin-64" using npm
Failed to install "esbuild-darwin-64" using npm: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/esbuild-wanvb3ttwfk'
Trying to download "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.11.10.tgz"
/usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/install.js:195
throw e;
^

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/bin/esbuild__'
at Object.openSync (fs.js:476:3)
at Object.writeFileSync (fs.js:1467:35)
at installBinaryFromPackage (/usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/install.js:58:6)
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
errno: -13,
syscall: 'open',
code: 'EACCES',
path: '/usr/local/lib/node_modules/netlify-cli/node_modules/esbuild/bin/esbuild__'
}
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/routing-local-proxy-win32-x64@0.30.1 (node_modules/netlify-cli/node_modules/@netlify/routing-local-proxy-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/routing-local-proxy-win32-x64@0.30.1: wanted {"os":"win32","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/routing-local-proxy-linux-x64@0.30.1 (node_modules/netlify-cli/node_modules/@netlify/routing-local-proxy-linux-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/routing-local-proxy-linux-x64@0.30.1: wanted {"os":"linux","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/routing-local-proxy-darwin-arm64@0.30.1 (node_modules/netlify-cli/node_modules/@netlify/routing-local-proxy-darwin-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/routing-local-proxy-darwin-arm64@0.30.1: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! esbuild@0.11.10 postinstall: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the esbuild@0.11.10 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I got the error above and then tried npm install --unsafe-perm=true -g netlify-cli. Even it works, still happens for MacOS with the details below;

System:
OS: macOS 11.3
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Memory: 131.25 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.1 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.8 - /usr/local/bin/npm

---

Still gives the warnings below even it successfully installs:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/routing-local-proxy-win32-x64@0.30.1 (node_modules/netlify-cli/node_modules/@netlify/routing-local-proxy-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/routing-local-proxy-win32-x64@0.30.1: wanted {"os":"win32","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/routing-local-proxy-linux-x64@0.30.1 (node_modules/netlify-cli/node_modules/@netlify/routing-local-proxy-linux-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/routing-local-proxy-linux-x64@0.30.1: wanted {"os":"linux","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/routing-local-proxy-darwin-arm64@0.30.1 (node_modules/netlify-cli/node_modules/@netlify/routing-local-proxy-darwin-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/routing-local-proxy-darwin-arm64@0.30.1: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})

@meera1002
Copy link

meera1002 commented Nov 28, 2022

I am getting this error on docker. I tried with node 18 and node 16. I also tried "npm install --unsafe-perm=true -g netlify-cli" but not working. #5260

npm ERR! code 127
[2022-11-22T19:33:40.625Z] #15 68.73 npm ERR! path /root/.nvm/versions/node/v18.12.1/lib/node_modules/netlify-cli/node_modules/@netlify/esbuild
[2022-11-22T19:33:40.625Z] #15 68.73 npm ERR! command failed
[2022-11-22T19:33:40.625Z] #15 68.73 npm ERR! command sh -c -- node install.js
[2022-11-22T19:33:40.625Z] #15 68.73 npm ERR! sh: 1: node: Permission denied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: installation init/es-func-bundle type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

9 participants