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

EBADPLATFORM from npm ci when running on netlify with >= 12.2.9 #5323

Closed
tjenkinson opened this issue Dec 18, 2022 · 10 comments · Fixed by #5359
Closed

EBADPLATFORM from npm ci when running on netlify with >= 12.2.9 #5323

tjenkinson opened this issue Dec 18, 2022 · 10 comments · Fixed by #5359
Labels
type: bug code to address defects in shipped code

Comments

@tjenkinson
Copy link

Describe the bug

npm ci on netlify fails with

7:41:18 PM: npm ERR! code EBADPLATFORM
7:41:18 PM: npm ERR! notsup Unsupported platform for @esbuild/android-arm@0.15.15: wanted {"os":"android","arch":"arm"} (current: {"os":"linux","arch":"x64"})
7:41:18 PM: npm ERR! notsup Valid OS:    android
7:41:18 PM: npm ERR! notsup Valid Arch:  arm
7:41:18 PM: npm ERR! notsup Actual OS:   linux
7:41:18 PM: npm ERR! notsup Actual Arch: x64
7:41:18 PM: npm ERR! A complete log of this run can be found in:
7:41:18 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-12-18T19_41_17_238Z-debug-0.log

See build run here

Steps to reproduce

View this test repo.

It does not contain a package-lock, meaning the first npm i generates a package-lock on the instance. It then does an npm ci, which fails with the error above.

This did not used to happen with versions <= 12.2.8.

Ref video-dev/hls.js#5114
Ref video-dev/hls.js#5115

Configuration

https://github.com/tjenkinson/netlify-cli-install-error/blob/main/netlify.toml

Environment

My local environment shouldn't be relevant for this. Please see the repro.

@tjenkinson tjenkinson added the type: bug code to address defects in shipped code label Dec 18, 2022
@danez
Copy link
Contributor

danez commented Dec 20, 2022

This is actually a problem in npm see npm/npm#2679 and evanw/esbuild#1707

I will try to manually patch our shrinkwrap to exclude these packages that were introduced in 26c409d#diff-44a7c69871c5958e657226d5552c9451606a778233fb824f68530d0cfd3f8994

@danez danez mentioned this issue Dec 20, 2022
5 tasks
@tjenkinson
Copy link
Author

Interesting maybe we can switch to a newer npm on netlify then to workaround it

@tjenkinson
Copy link
Author

Although we are on the most recent lts (18.12.1) so it would be great if it could work again with that

wmfgerrit pushed a commit to wikimedia/wikidata-query-builder that referenced this issue Jan 9, 2023
v12.5.0 is causing issues. This is a known bug.
Check: netlify/cli#5323

Bug: T326198
Change-Id: I89907bb2beb58142a311ebb793b75dc642fa5f49
@tjenkinson
Copy link
Author

tjenkinson commented Jan 10, 2023

Any fix planned for this? We are now getting prompted to upgrade to fix a security issue

thanks

@danez
Copy link
Contributor

danez commented Jan 11, 2023

Unfortunately, we cannot fix this from our side at the moment yet. npm seems to have a lot of issues with shrinkwrapping, and all attempts to fix this so far just created more problems.

@tjenkinson
Copy link
Author

Ok thanks for trying.

I wrote a small cli to workaround the issue. https://github.com/tjenkinson/npm-ci-please

So we can use npx -y npm-ci-please@1 in place of npm ci and it should just work™️

Hopefully at some point npm will actually fix the root of the problem 🤞

JiriLojda pushed a commit to kontent-ai/integration-example-algolia that referenced this issue Mar 1, 2023
- pinned version is 12.2.8 as the installation seems to fail since 12.2.9 see (netlify/cli#5323) for details
@csvn
Copy link

csvn commented Mar 28, 2023

Couldn't find a solution to this issue. Guess we're stuck at 12.2.8 of netlify-cli, where we can run npm ci without errors.

@csvn
Copy link

csvn commented Mar 28, 2023

I'm not overly familiar with npm shrinkwrap, but wouldn't it be a solution to use package-lock.json to keep pinned dependency versions inside of this project and for workflows. Then remove npm shrinkwrap to avoid optional dependency issues?

It was very hard to debug the issue that netlify-cli prevents npm ci and npm audit fix from working correctly, since there's not much we can do to fix this. Pinning to an old netlify-cli version is the only "solution" I've found so far, and I'm using npm v9.5.0 and Node v18.15.0.

@danez
Copy link
Contributor

danez commented Apr 14, 2023

In my first tests, the changes from #5547 do seem to fix this problem.
There is a prerelease version of version 14 ready, if anyone of you could test if it actually fixes the problem for you?

netlify-cli@14.0.0-rc (Changelog: #5600)

@MikeMcC399
Copy link

@danez

It looks like this is now resolved with release v14.0.0.

After updating from netlify-cli@13.2.2 to netlify-cli@14.0.0 I could not reproduce the issue any longer.

Many thanks! 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants