無法在 macOS 上安裝 Brain.js
P粉044526217
P粉044526217 2024-03-31 11:29:06
0
1
648

我使用的是 m1 mac,我正在嘗試安裝 Brain.js,但它不工作。

運行 python --version 時,我得到 Python 3.11.3

#執行 /usr/bin/xcodebuild -version 時,我得到 Xcode 14.3 Build version 14E222b

#但當我執行 npm i Brain.js 時出現以下錯誤

npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm ERR! code 1
npm ERR! path /Users/chaim/developer/personal/tax-docs/node_modules/gpu.js/node_modules/gl
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! prebuild-install warn install No prebuilt binaries found (target=18.15.0 runtime=node arch=arm64 libc= platform=darwin)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.1
npm ERR! gyp info using node@18.15.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.3 found at "/opt/homebrew/opt/python@3.11/bin/python3.11"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.11/bin/python3.11
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/chaim/developer/personal/tax-docs/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/chaim/developer/personal/tax-docs/node_modules/gpu.js/node_modules/gl/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/chaim/developer/personal/tax-docs/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/chaim/Library/Caches/node-gyp/18.15.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/chaim/Library/Caches/node-gyp/18.15.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/chaim/developer/personal/tax-docs/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/chaim/Library/Caches/node-gyp/18.15.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/chaim/developer/personal/tax-docs/node_modules/gpu.js/node_modules/gl',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /bin/sh: python: command not found
npm ERR! gyp: Call to 'python commit_id.py check ..' returned exit status 127 while in angle/src/angle.gyp. while loading dependencies of
     binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/chaim/developer/personal/tax-docs/node_modules/node-gyp/lib/configure.js:325:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 22.5.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/chaim/developer/personal/tax-docs/node_modules/.bin/node-gyp"
     "rebuild"
npm ERR! gyp ERR! cwd /Users/chaim/developer/personal/tax-docs/node_modules/gpu.js/node_modules/gl
npm ERR! gyp ERR! node -v v18.15.0
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

有什麼想法嗎?

P粉044526217
P粉044526217

全部回覆(1)
P粉557957970

在 MacOS Monterey 中,他們刪除了預設安裝的 python 2。

您可能需要手動安裝版本 2。

您也可以嘗試欺騙安裝程式使用版本 3:

ln -s /opt/homebrew/bin/python3 /opt/homebrew/bin/python

編輯:可以確認這在我的 M1 盒子上有效。

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板