I cannot install '@tensorflow/tfjs-node'
I installed it using 'npm install @tensorflow/tfjs-node' but the installations fails. I tried installing 'node-pre-gyp' globally, with and without root permissions but no success. I run on node v12.9.0.
> [email protected] install /Users/username/Documents/Development/AI/Tensorflow/node_modules/fsevents
> node install
node-pre-gyp WARN Using needle for node-pre-gyp https download
[fsevents] Success: "/Users/username/Documents/Development/AI/Tensorflow/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" is installed via remote
> @tensorflow/[email protected] install /Users/username/Documents/Development/AI/Tensorflow/node_modules/@tensorflow/tfjs-node
> node scripts/install.js
CPU-darwin-1.2.9.tar.gz
* Downloading libtensorflow
[==============================] 10422374/bps 100% 0.0s
* 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 needle 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.2.9/CPU-darwin-1.2.9.tar.gz
node-pre-gyp WARN Pre-built binaries not found for @tensorflow/[email protected] and [email protected] (node-v72 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:209:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/username/Documents/Development/AI/Tensorflow/node_modules/@tensorflow/tfjs-node/lib/napi-v4/tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=/Users/username/Documents/Development/AI/Tensorflow/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/username/Documents/Development/AI/Tensorflow/node_modules/@tensorflow/tfjs-node
gyp ERR! node -v v12.9.0
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/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/username/Documents/Development/AI/Tensorflow/node_modules/@tensorflow/tfjs-node/lib/napi-v4/tfjs_binding.node --module_name=tfjs_binding --module_path=/Users/username/Documents/Development/AI/Tensorflow/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/username/Documents/Development/AI/Tensorflow/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:209:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Darwin 19.0.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/username/Documents/Development/AI/Tensorflow/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/username/Documents/Development/AI/Tensorflow/node_modules/@tensorflow/tfjs-node
node-pre-gyp ERR! node -v v12.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
> [email protected] postinstall /Users/username/Documents/Development/AI/Tensorflow/node_modules/nodemon
> node bin/postinstall || exit 0
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
added 362 packages from 202 contributors and audited 2419 packages in 11.642s
found 0 vulnerabilities
node-pre-gyp failes to install and 'CPU-darwin-1.2.9.tar.gz' no longer seems to exist, so I get an 404 error.
Also this question if probably somewhat of a duplicate to this question: Cannot import @tensorflow/tfjs-node in nodejs
EDIT: Tried to downgrade to @tensorflow/[email protected], but the error is still there:
CPU-darwin-1.2.8.tar.gz
* Downloading libtensorflow
[==============================] 10642013/bps 100% 0.0s
* 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 needle 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.2.8/tfjs_binding-v1.2.8-node-v72-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for @tensorflow/[email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp
is a nice tool in that it can download precompiled binaries for you which can save a lot of time. The problem is that there still has to be binaries built for your exact version of nodejs.
In your case it seems like none are available (the below line is in the logfile you posted).
node-pre-gyp WARN Tried to download(404): https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v4/1.2.9/CPU-darwin-1.2.9.tar.gz
node-pre-gyp WARN Pre-built binaries not found for @tensorflow/[email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
If we look at the url it tried to download however there seems to be a file available for version 1.2.8 (you can get a list of available files at https://storage.googleapis.com/tf-builds/).
So either you downgrade @tensorflow/tfjs-node to 1.2.8 and tries that or you check out the instructions for node-gyp to actually get it to build stuff on your machine (which is probably the best thing long term).
I solved the same problem with this command
npm install --production windows-build-tools
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With