tensorflowtensorflow.jstfjs-node

Fail to rebuild npm rebuild @tensorflow/tfjs-node build-addon-from-source


I have no idea whats happening here. I've seen solutions with electron but it does not apply to this context.

My node -v is v10.16.3

My package.json is:

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

My code was running yesterday. Now when I run node bot.js, it gives me the following:

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. 

When I run they ask me to run: npm rebuild @tensorflow/tfjs-node build-addon-from-source, I get:

@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

Thanks in advance.


Solution

  • Try running this:

    xcode-select --install
    npm i node-pre-gyp -g
    npm rebuild @tensorflow/tfjs-node --build-from-source