在npm安装M1 Big Sur时出现尖锐的返回错误



我正试图为我的项目安装sharp。当运行npm i和npm install sharp时,我收到了关于sharp的相同错误(如下所示)。我试过在全球和本地安装libvip,并阅读了关于这个问题的每一个线程,似乎找不到正确的解决方案。欢迎提出任何建议。

rosetta error: /var/db/oah/223263137464320_223263137464320/e6ddd63cd8fd3b7ef226e2cad9a1bead9d7f41f60d7ece6edd0cdcc0c33c97c6/libxcrun.dylib.aot: attachment of code signature supplement failed: 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: null
gyp ERR! stack     at ChildProcess.onExit (/Users/elektra.murphy/.nvm/versions/node/v11.11.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/Users/elektra.murphy/.nvm/versions/node/v11.11.0/bin/node" "/Users/elektra.murphy/.nvm/versions/node/v11.11.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/elektra.murphy/Desktop/Projects/node_modules/sharp
gyp ERR! node -v v11.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/Users/elektra.murphy/Desktop/Projects/package.json'
npm WARN No description
npm WARN No repository field.
npm WARN No README data
npm WARN No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.23.2 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sharp@0.23.2 install 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!     /Users/elektra.murphy/.npm/_logs/2021-10-12T08_24_48_579Z-debug.log

在Sharp文档中找到了解决方案:当使用npm v6或更早的版本时,当以root或sudo用户安装时必须使用npm install——unsafe-perm标志。似乎已经工作-现在到下一个错误!

在这里找到更多关于M1安装的信息:

https://sharp.pixelplumbing.com/install

最新更新