GitHub Action npm i fails when package.json includes fsevents
source link: https://www.kevinhooke.com/2022/09/14/github-action-npm-i-fails-when-package-json-includes-fsevents/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
GitHub Action npm i fails when package.json includes fsevents
I’ve added a GitHub Action to a project, and when it runs on a push I get this error:
Run npm ci npm ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"}) npm ERR! notsup Valid OS: darwin npm ERR! notsup Valid Arch: undefined npm ERR! notsup Actual OS: linux npm ERR! notsup Actual Arch: x64 npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/_logs/2022-09-11T23_52_20_527Z-debug-0.log Error: Process completed with exit code 1.
fsevents is installed/added when doing ‘npm i’ as a dependency when building on MacOS, but it is MacOS specific, and since it’s included in my package.json it’s causing the build on GitHub to fail. Apparently according to this post, it can be optionally included on platforms where it’s available/needed by moving it from the dependencies section in package.json to optionalDependencies instead:
"optionalDependencies": { "fsevents": "^2.3.2" }
This resolved my issue, my GitHub Action now runs.
CategoriesKev's BlogTagsgithub, github actions, node, node.js, npm
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Notify me of follow-up comments by email.
Notify me of new posts by email.
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Post navigation
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK