繁体   English   中英

“darwin-arm64v8”二进制文件不能在“darwin-x64”平台上使用

[英]'darwin-arm64v8' binaries cannot be used on the 'darwin-x64' platform

我正在尝试使用我的 Mac M1 将功能部署到 firebase ,为此需要执行npm install才能在node_modules/中安装软件包。 我收到此错误:

Error: 'darwin-arm64v8' binaries cannot be used on the 'darwin-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'darwin-x64' platform.
    at Object.hasVendoredLibvips (/Users/ali/Desktop/tajir/backend-mvp/appengine/back-end-flex/node_modules/sharp/lib/libvips.js:80:13)
    at Object.<anonymous> (/Users/ali/Desktop/tajir/backend-mvp/appengine/back-end-flex/node_modules/sharp/lib/constructor.js:7:22)
    at Module._compile (internal/modules/cjs/loader.js:1136:30)
    at Module._compile (pkg/prelude/bootstrap.js:1394:32)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1156:10)
    at Module.load (internal/modules/cjs/loader.js:984:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1024:19)
    at Module.require (pkg/prelude/bootstrap.js:1338:31)
    at require (internal/modules/cjs/helpers.js:72:18)

我的回答与将功能部署到 firebase 无关,但我遇到了完全相同的错误:

Error: '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.

当我尝试使用不兼容的节点版本运行带有 mac M1 的项目时。

当项目实际需要版本 <=14 时,我尝试使用版本 16 运行项目。

所以如果有人有这个问题可能值得检查节点版本

通常拥有 Mac M1 的人会遇到这个问题。 Mac M1 处理器是arm64 这里发布一个解决方案,需要将终端架构更改为arch -x86_64 zsh ,我不想这样做。

所以,这就是我能够发现的解决方法(错误中也提到了一些步骤):

rm -rf node_modules/sharp
npm install --arch=x64 --platform=darwin sharp

对我来说,我所要做的就是:

brew reinstall vips

然后对项目进行全新安装。

出于某种原因,我通过删除node_modules并再次安装它们来修复它。

Error: '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.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM