M1 Big Sur 上的 Npm 安装失败 - “usr/lib/libcurl.dylib(没有这样的文件或目录)”

时间:2021-06-24 07:18:39

标签: node.js reactjs npm macos-big-sur

试图将我的 react webapp 克隆到新的 M1 Mac,但似乎无法解决这个问题。

  • Macbook Air M1 macOS
  • 大苏尔 11.4
  • 安装了Xcode
  • 尝试了不同的节点版本 (nvm)
  • 尝试通过 Brew 等安装 libcurl。

运行 npm install:

npm WARN deprecated node-pre-gyp@0.15.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future

> node-libcurl@2.3.3 install /Users/peterstahl/Documents/peepz/node_modules/node-libcurl
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://github.com/JCMais/node-libcurl/releases/download/v2.3.3/node_libcurl-v2.3.3-node-v72-darwin-arm64-unknown.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for node-libcurl@2.3.3 and node@12.22.1 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic: can't open file: /usr/lib/libcurl.dylib (No such file or directory)
gyp: Call to 'otool -D `curl-config --prefix`/lib/libcurl.dylib | sed -n 2p' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/peterstahl/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 20.5.0
gyp ERR! command "/Users/peterstahl/.nvm/versions/node/v12.22.1/bin/node" "/Users/peterstahl/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/peterstahl/Documents/peepz/node_modules/node-libcurl/lib/binding/node_libcurl.node" "--module_name=node_libcurl" "--module_path=/Users/peterstahl/Documents/peepz/node_modules/node-libcurl/lib/binding" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /Users/peterstahl/Documents/peepz/node_modules/node-libcurl
gyp ERR! node -v v12.22.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/Users/peterstahl/.nvm/versions/node/v12.22.1/bin/node /Users/peterstahl/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/peterstahl/Documents/peepz/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl --module_path=/Users/peterstahl/Documents/peepz/node_modules/node-libcurl/lib/binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/peterstahl/Documents/peepz/node_modules/node-libcurl/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1022:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Darwin 20.5.0
node-pre-gyp ERR! command "/Users/peterstahl/.nvm/versions/node/v12.22.1/bin/node" "/Users/peterstahl/Documents/peepz/node_modules/node-libcurl/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/peterstahl/Documents/peepz/node_modules/node-libcurl
node-pre-gyp ERR! node -v v12.22.1
node-pre-gyp ERR! node-pre-gyp -v v0.15.0
node-pre-gyp ERR! not ok 
Failed to execute '/Users/peterstahl/.nvm/versions/node/v12.22.1/bin/node /Users/peterstahl/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/peterstahl/Documents/peepz/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl --module_path=/Users/peterstahl/Documents/peepz/node_modules/node-libcurl/lib/binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.14.5 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-proposal-class-static-block@7.14.5 requires a peer of @babel/core@^7.12.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN bringfire2@0.1.0 No description
npm WARN bringfire2@0.1.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-libcurl@2.3.3 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-libcurl@2.3.3 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/peterstahl/.npm/_logs/2021-06-24T06_04_49_403Z-debug.log

1 个答案:

答案 0 :(得分:0)

我在我的 mac 中看到了同样的问题,只需在项目根文件夹中使用此命令即可解决

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo npm install --unsafe-perm=true --allow-root