npm - M1 Big Sur 的 npm install 出现急剧返回错误
问题描述
我正在尝试为我的项目安装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 安装的更多信息:
推荐阅读
- parsing - 从 pdf 或图像格式的发票中提取数据
- java - 如何在集成测试中使 JPQL 查询与 h2 兼容
- android - 如何从 Google Cloud Firestore 获取随机且唯一的文档?
- java - System.getenv() 返回的映射是什么以及如何在此映射中设置值?
- php - 使用 PHP 会话连接到 MySQL
- excel - 作为 DWORD 传递给 WIN32 API 函数 MonitorFromWindow 的值
- python - Python:如何动态更改 Bokeh 选择小部件中的选项?
- android - 如何在 Build.gradle 中使用预定义的依赖项获取新版本警告?
- laravel - 方法 Illuminate\Database\Eloquent\Collection::links 不存在
- azure - ARM 返回要在 Terraform 脚本中使用的应用服务环境 ID