![](/img/trans.png)
[英]centos6.2 upgrade python2.7 _hashlib and _ssl build failed and make [Modules/_ssl.o] Error 1
[英]failed to build native modules on after node 16 upgrade and MacOS upgrade
我已經升級到 MacOS Monterey (12.3.1) 和 Node 16。從那時起,由於@newrelic/native-metrics
出現以下錯誤,我無法在某些節點模塊上運行安裝:
Error running install script for optional dependency: "/Users/zivl/github/data-science-client/serverless/ml-platform-services/node_modules/@newrelic/native-metrics: Command failed.
Exit code: 1
Command: node ./lib/pre-build.js install native_metrics
在挖掘日志時,我發現它正在使用node-gyp
和python
,所以我想可能由於升級我需要重新安裝它們 - 所以我這樣做了。 但重新安裝node-gyp
/ python
(包括切換多個python
版本(3.7、3.9、3.10)) - 仍然沒有幫助。
我檢查了 node-gyp 日志並看到以下內容:
node-pre-gyp http 404 https://github.com/hyj1991/v8-profiler-node8/releases/download/v6.3.0/profiler-v6.3.0-node-v93-darwin-x64.tar.gz
node-pre-gyp WARN Tried to download(404): https://github.com/hyj1991/v8-profiler-node8/releases/download/v6.3.0/profiler-v6.3.0-node-v93-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for v8-profiler-node8@6.3.0 and node@16.14.2 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
...
Failed to execute native-metrics install: No pre-built artifacts to download for your OS/architecture.
v8-profiler-node8
沒有節點 16 的版本。我試圖在網上尋找它,但到目前為止沒有找到任何解決方案:(
最好完全消除這樣的問題。
如果可能,容器化您的應用程序,例如使用 Docker。 除非您專門為 Mac OS 編寫應用程序。
https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
它將確保這種情況不會再發生,可能比一次性解決方案更好:)
最終,幫助我解決問題的是執行以下操作之一:
手動安裝node-gyp
的全局包,您應該將節點設置為僅運行該版本(在線閱讀更多信息,我會嘗試找到鏈接,但它在網絡上的任何地方)。
切換到yarn 3
和pnpm
,使用這些包管理器,默認情況下不會像在npm
中那樣安裝第 3 方腳本
你總是可以使用npm install --ignore-scripts
但是到處都有這個標志很糟糕......
在pypenv
global中有兩個版本的python, python2
和python3
我希望這能以某種方式幫助您,非常歡迎其他答案和解決方案:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.