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

darwin-arm64v8 platform error #168

Closed
MattArnold opened this issue Dec 15, 2022 · 7 comments
Closed

darwin-arm64v8 platform error #168

MattArnold opened this issue Dec 15, 2022 · 7 comments

Comments

@MattArnold
Copy link

Operating system

macOS Ventura 13.0.1

Eleventy

^0.11.1

Describe the bug

I'm running Spacebook with Eleventy. Everything worked as expected, until I upgraded the MacOS version from Monterey to Ventura.

npm start in iTerm2 to run the site locally outputs an error:

> eleventy --serve & postcss styles/tailwind.css --o _tmp/style.css --watch

Eleventy fatal error: (more in DEBUG output)
> Error in your Eleventy config file '/Users/____/___/_________________/.eleventy.js'.

`EleventyConfigError` was thrown
> 'darwin-x64' binaries cannot be used on the 'darwin-arm64v8' platform. Please remove the 
'node_modules/sharp' directory and run 'npm install' on the 'darwin-arm64v8' platform.

Removing the 'node_modules/sharp' directory and running 'npm install', as directed in the error message, changes nothing.

When I push changes, Netlify still builds the site on the web without errors; the problem only occurs locally.

Additional context
MacBook Pro 16-inch, 2021, Apple M1 Max, Ventura 13.0.1
iTerm2 3.4.16 using zsh and fig

Reproduction steps

  1. Upgrade MacOS from Monterey to Ventura
  2. In iTerm2, cd to project directory
  3. run npm start

Expected behavior

npm start should build the site with its new changes (if any), start a server locally, and output a localhost address to the terminal, with which to see the changes to the site in the browser.

Reproduction URL

No response

Screenshots

Screenshot 2022-12-14 at 10 45 33 AM

@zachleat
Copy link
Member

What version of sharp do you have after reinstall? We may need to issue a new version for sharp v0.31.x`

@zachleat zachleat transferred this issue from 11ty/eleventy Dec 15, 2022
@pdehaan
Copy link
Contributor

pdehaan commented Dec 15, 2022

I'd also try bumping Eleventy to v1.x (although I'm suspecting this is more related to eleventy-img).
See https://sharp.pixelplumbing.com/install

Apple M1

Prebuilt sharp and libvips binaries have been provided for macOS on ARM64 since sharp v0.29.0.

Plus per the error output:

Please remove the 'node_modules/sharp' directory and run npm install on the 'darwin-arm64v8' platform.

@zachleat
Copy link
Member

Yeah, this should be strictly an eleventy-img issue—I did transfer it over earlier!

@zachleat
Copy link
Member

This is an automated message to let you know that this issue requires additional input from the original poster and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.

Do not let the issue’s closing deter you. After you’ve supplied the required information, the issue will be reopened. Thanks!

@zachleat
Copy link
Member

zachleat commented Jan 30, 2023

Note that sharp 0.31 is shipping with Eleventy Image v3.0.0 shortly.

@tedw
Copy link

tedw commented Feb 12, 2024

After upgrading to 4.0.2 I’m getting this error:

[start:eleventy] [11ty] 2. Could not load the "sharp" module using the darwin-arm64 runtime

See full output
[start:eleventy] $ wait-on _site/assets/manifest.json && eleventy --serve
[start:webpack ] $ webpack --watch
[start:webpack ] 14 assets
[start:webpack ] 78 modules
[start:webpack ] webpack 5.90.1 compiled successfully in 1244 ms
[start:eleventy] [11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[start:eleventy] [11ty] 1. Error in your Eleventy config file '.eleventy.js'. (via EleventyConfigError)
[start:eleventy] [11ty] 2. Could not load the "sharp" module using the darwin-arm64 runtime
[start:eleventy] [11ty] Possible solutions:
[start:eleventy] [11ty] - Ensure optional dependencies can be installed:
[start:eleventy] [11ty]     npm install --include=optional sharp
[start:eleventy] [11ty]     yarn add sharp --ignore-engines
[start:eleventy] [11ty] - Ensure your package manager supports multi-platform installation:
[start:eleventy] [11ty]     See https://sharp.pixelplumbing.com/install#cross-platform
[start:eleventy] [11ty] - Add platform-specific dependencies:
[start:eleventy] [11ty]     npm install --os=darwin --cpu=arm64 sharp
[start:eleventy] [11ty] - Consult the installation documentation:
[start:eleventy] [11ty]     See https://sharp.pixelplumbing.com/install (via Error)
[start:eleventy] [11ty]
[start:eleventy] [11ty] Original error stack trace: Error: Could not load the "sharp" module using the darwin-arm64 runtime
[start:eleventy] [11ty] Possible solutions:
[start:eleventy] [11ty] - Ensure optional dependencies can be installed:
[start:eleventy] [11ty]     npm install --include=optional sharp
[start:eleventy] [11ty]     yarn add sharp --ignore-engines
[start:eleventy] [11ty] - Ensure your package manager supports multi-platform installation:
[start:eleventy] [11ty]     See https://sharp.pixelplumbing.com/install#cross-platform
[start:eleventy] [11ty] - Add platform-specific dependencies:
[start:eleventy] [11ty]     npm install --os=darwin --cpu=arm64 sharp
[start:eleventy] [11ty] - Consult the installation documentation:
[start:eleventy] [11ty]     See https://sharp.pixelplumbing.com/install
[start:eleventy] [11ty]     at Object.<anonymous> (/Users/twhitehead/Sites/trevor-survey-international/node_modules/sharp/lib/sharp.js:114:9)
[start:eleventy] [11ty]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[start:eleventy] [11ty]     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
[start:eleventy] [11ty]     at Module.load (node:internal/modules/cjs/loader:1207:32)
[start:eleventy] [11ty]     at Module._load (node:internal/modules/cjs/loader:1023:12)
[start:eleventy] [11ty]     at Module.require (node:internal/modules/cjs/loader:1235:19)
[start:eleventy] [11ty]     at require (node:internal/modules/helpers:176:18)
[start:eleventy] [11ty]     at Object.<anonymous> (/Users/twhitehead/Sites/trevor-survey-international/node_modules/sharp/lib/constructor.js:10:1)
[start:eleventy] [11ty]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[start:eleventy] [11ty]     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
[start:eleventy] error Command failed with exit code 1.
[start:eleventy] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I was able to fix it by installing sharp with yarn add sharp --ignore-engines.

FWIW you can also resolve the issue by adding the following to package.json:

"resolutions": {
  "sharp": "~0.32.0"
},

I’m running Node 20.11.0 and Eleventy 2.0.1 on an M2 Pro.

Here are some similar threads:

FWIW I tried these suggestions but none of them worked:

  • brew reinstall vips
  • SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm_config_arch=arm64 npm_config_platform=darwin yarn add sharp

@wahyudies
Copy link

FWIW you can also resolve the issue by adding the following to package.json:

"resolutions": {
  "sharp": "~0.32.0"
},

Work in my case, running at:

Node: 19.5.0
MacOS: Sonoma-14.3.1
@11ty/eleventy: 2.0.1
@11ty/eleventy-img: 4.0.2

Thank you @tedw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants