question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build

See original GitHub issue

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): NO
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
ProductName:    Mac OS X
ProductVersion: 10.14.5
BuildVersion:   18F132
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: Not applicable
  • TensorFlow.js installed from (npm or script link): Latest version from command npm i @tensorflow/tfjs-node
  • TensorFlow.js version (use command below):
  • Browser version: Not applicable using Node.JS
  • Tensorflow.js Converter Version: Not applicable

Describe the current behavior Installation error after npm i @tensorflow/tfjs-node

> @tensorflow/tfjs-node@2.4.0 install /Users/loretoparisi/Documents/Projects/AI/tensorflow-node-examples/toxicity/node_modules/@tensorflow/tfjs-node
> node scripts/install.js

CPU-darwin-2.4.0.tar.gz
* Downloading libtensorflow
[==============================] 8801882/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-v5/2.4.0/CPU-darwin-2.4.0.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for @tensorflow/tfjs-node@2.4.0 and node@12.16.1 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 
Traceback (most recent call last):
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
    return gyp_main(args)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 532, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2215, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 845, in Write
    mac_bundle_deps, extra_outputs, part_of_all)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1539, in WriteTarget
    self.WriteSortedXcodeEnv(self.output, self.GetSortedXcodePostbuildEnv())
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1896, in GetSortedXcodePostbuildEnv
    additional_settings={'CHROMIUM_STRIP_SAVE_FILE': strip_save_file})
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1885, in GetSortedXcodeEnv
    additional_settings)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1616, in GetSortedXcodeEnv
    additional_settings)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1527, in _GetXcodeEnv
    if XcodeVersion() >= '0500' and not env.get('SDKROOT'):
TypeError: '>=' not supported between instances of 'tuple' and 'str'
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:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 18.6.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/loretoparisi/Documents/Projects/AI/tensorflow-node-examples/toxicity/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=/Users/loretoparisi/Documents/Projects/AI/tensorflow-node-examples/toxicity/node_modules/@tensorflow/tfjs-node/lib/napi-v5" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=5" "--node_napi_label=napi-v5"
gyp ERR! cwd /Users/loretoparisi/Documents/Projects/AI/tensorflow-node-examples/toxicity/node_modules/@tensorflow/tfjs-node
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.0.5
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/loretoparisi/Documents/Projects/AI/tensorflow-node-examples/toxicity/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node --module_name=tfjs_binding --module_path=/Users/loretoparisi/Documents/Projects/AI/tensorflow-node-examples/toxicity/node_modules/@tensorflow/tfjs-node/lib/napi-v5 --napi_version=5 --node_abi_napi=napi --napi_build_version=5 --node_napi_label=napi-v5' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/loretoparisi/Documents/Projects/AI/tensorflow-node-examples/toxicity/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
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:286:5)
node-pre-gyp ERR! System Darwin 18.6.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/loretoparisi/Documents/Projects/AI/tensorflow-node-examples/toxicity/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/loretoparisi/Documents/Projects/AI/tensorflow-node-examples/toxicity/node_modules/@tensorflow/tfjs-node
node-pre-gyp ERR! node -v v12.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok

Describe the expected behavior the command npm i @tensorflow/tfjs-node should succeed.

Standalone code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/CodePen/any notebook.

I have used to following install command in a clean folder

npm i @tensorflow/tfjs-node

Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Not applicable - log reported above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
jonit-devcommented, Jul 24, 2021

To fix the issue (worked for me on Ubuntu 18)

sudo apt-get update
sudo apt-get install build-essential
npm i node-pre-gyp -g

(if your using tfjs-node-gpu)
npm rebuild @tensorflow/tfjs-node-gpu --build-from-source

(or if your using tfjs-node instead)
npm rebuild @tensorflow/tfjs-node --build-from-source
1reaction
loretoparisicommented, Oct 2, 2020

The other approach I have used was to reinstall npm doing sudo npm install npm@latest -g so I have

$ npm --version
6.14.8

and now it works! 💯

The problem now becomes th 2nd one, I have cited here

ip-192-168-178-22:toxicity loretoparisi$ node test.js Platform node has already been set. Overwriting the platform with [object Object].
Platform node has already been set. Overwriting the platform with [object Object].
/Users/loretoparisi/Documents/MyProjects/AI/tfjs-models/toxicity/node_modules/@tensorflow/tfjs-backend-cpu/dist/tf-backend-cpu.node.js:268
var nonMaxSuppressionV3Impl = tf.kernel_impls.nonMaxSuppressionV3Impl;
                                              ^

TypeError: Cannot read property 'nonMaxSuppressionV3Impl' of undefined
    at Object.<anonymous> (/Users/loretoparisi/Documents/MyProjects/AI/tfjs-models/toxicity/node_modules/@tensorflow/tfjs-backend-cpu/dist/tf-backend-cpu.node.js:268:47)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/Users/loretoparisi/Documents/MyProjects/AI/tfjs-models/toxicity/node_modules/@tensorflow/tfjs/dist/tf.node.js:25:22)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)

Closing this specific one then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`node-pre-gyp install --fallback-to-build` failed during MeanJS ...
i have tried upgrading node-gyp: sudo npm install -g node-gyp. It worked for me. I find the solution here, I hope it can...
Read more >
node-pre-gyp install --fallback-to-build · Issue #477 - GitHub
When installing sqlite3, npm fails on node-pre-gyp with error: node-pre-gyp ERR! Completion callback never invoked! node-pre-gyp ERR!
Read more >
`node-pre-gyp install --fallback-to-build` on Linux - YouTube
How to install bcrypt on Windows and Linux The steps are as follows : Install stable version of node withsudo npm cache clean...
Read more >
npm ERR! sqlite3@4.1.0 install: `node-pre-gyp install
Hi Everyone, Hope you all doing good and Safe at homes. Since 2 days I am working on existing project to build and...
Read more >
Bcrypt Npm Install Error - Error: Cannot Find Module Node-Pre ...
nodepregyp build fail error while installing with npm install or npm InstalledDir: /Library/Developer/CommandLineTools/usr/bin; Module: gyp ERR! stack ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found