1

我不知道这里发生了什么。我已经看到了电子的解决方案,但它不适用于这种情况。

我的节点 -v 是 v10.16.3

我的 package.json 是:

"@tensorflow-models/mobilenet": "^2.0.4",
"@tensorflow/tfjs": "^1.7.4",
"@tensorflow/tfjs-node": "^1.7.4",

我的代码昨天正在运行。现在,当我运行时node bot.js,它给了我以下信息:

node-pre-gyp info This Node instance does not support builds for N-API version 5
node-pre-gyp info This Node instance does not support builds for N-API version 5
/Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/@tensorflow/tfjs-node/dist/index.js:49
    throw new Error("The Node.js native addon module (tfjs_binding.node) can not "
    ^

Error: The Node.js native addon module (tfjs_binding.node) can not be found at path: /Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/@tensorflow/tfjs-node/lib/napi-v4/tfjs_binding.node. 
Please run command 'npm rebuild @tensorflow/tfjs-node build-addon-from-source' to rebuild the native addon module. 

当我跑步时,他们要求我跑步:npm rebuild @tensorflow/tfjs-node build-addon-from-source,我得到:

@tensorflow/tfjs-node@1.7.4 install /Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/@tensorflow/tfjs-node
node scripts/install.js

CPU-darwin-1.7.4.tar.gz
* Building TensorFlow Node.js bindings
node-pre-gyp install failed with error: Error: Command failed: 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://storage.googleapis.com/tf-builds/pre-built-binary/napi-v4/1.7.4/CPU-darwin-1.7.4.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for @tensorflow/tfjs-node@1.7.4 and node@10.16.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:344:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/lib/node_modules/node/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/@tensorflow/tfjs-node/lib/napi-v4/tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=/Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/@tensorflow/tfjs-node/lib/napi-v4" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=4" "--node_napi_label=napi-v4"
gyp ERR! cwd /Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/@tensorflow/tfjs-node
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/lib/node_modules/node/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/@tensorflow/tfjs-node/lib/napi-v4/tfjs_binding.node --module_name=tfjs_binding --module_path=/Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/@tensorflow/tfjs-node/lib/napi-v4 --napi_version=4 --node_abi_napi=napi --napi_build_version=4 --node_napi_label=napi-v4' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Darwin 19.6.0
node-pre-gyp ERR! command "/usr/local/lib/node_modules/node/bin/node" "/Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/@tensorflow/tfjs-node
node-pre-gyp ERR! node -v v10.16.3
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok 

@tensorflow/tfjs-node@1.7.4 /Users/cyrus/Documents/Personal_projects/debord_slow_sender_meme/bot_side/node_modules/@tensorflow/tfjs-node

提前致谢。

4

1 回答 1

0

尝试运行这个:

xcode-select --install
npm i node-pre-gyp -g
npm rebuild @tensorflow/tfjs-node --build-from-source
于 2021-03-20T06:54:26.817 回答