tfjs: Error when installing @tensorflow/tfjs-node

To get help from the community, check out our Google group.

TensorFlow.js version

Browser version

Describe the problem or feature request

Error when installing `@tensorflow/tfjs-node``

I get this Error:

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild Traceback (most recent call last): File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module> sys.exit(gyp.script_main()) File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, 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 538, in main return gyp_main(args) File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 523, 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 2213, 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 793, in Write extra_mac_bundle_resources, part_of_all) File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 967, in WriteActions "Spaces in action input filenames not supported (%s)" % input) AssertionError: Spaces in action input filenames not supported (/Users/jonas/Web Dev/NodeJS/RestAPITest/node_modules/@tensorflow/tfjs-node/scripts/deps-stage.js) 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:345:16) gyp ERR! stack at emitTwo (events.js:126:13) gyp ERR! stack at ChildProcess.emit (events.js:214:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) gyp ERR! System Darwin 17.5.0 gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild” gyp ERR! cwd /Users/jonas/Web Dev/NodeJS/RestAPITest/node_modules/@tensorflow/tfjs-node gyp ERR! node -v v8.11.2 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok

at cp.exec (/Users/jonas/Web Dev/NodeJS/RestAPITest/node_modules/@tensorflow/tfjs-node/scripts/install.js:154:13)
at ChildProcess.exithandler (child_process.js:282:5)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:557:12)

npm WARN restapitest@1.0.0 No description npm WARN restapitest@1.0.0 No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @tensorflow/tfjs-node@0.1.17 install: node scripts/install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @tensorflow/tfjs-node@0.1.17 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/jonas/.npm/_logs/2018-09-19T16_23_53_635Z-debug.log Jonass-MBP:RestAPITest jonas$`

Code to reproduce the bug / link to feature request

Running npm install @tensorflow/tfjs-node on a Mac with Node version 6.4.1. XCode is installed.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 43 (8 by maintainers)

Most upvoted comments

Hi @JonasJW ,

This error is because the directory you are using (/Users/jonas/Web Dev/NodeJS/RestAPITest) has a space in the path (within “Web Dev”), as listed in the error logs, “Spaces in action input filenames not supported” by node-gyp binding tool.

Could you please rename the directory or move it to another directory and try again?

Thanks, Kangyi

plss help me to install npm install @tensorflow/tfjs-node on my system

Hi @HarryChang30

Can you try to run npm install --production windows-build-tools and then try to install tfjs-node again? Several users and I had the same issue and it’s resolved by reinstall windows-build-tools.

None of the above worked for me. However: Watch out which MSBuild.exe is actually being used by gyp. I had Visual Studio Community installed next to the Build Tools and gyp always used the one of the community version. C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe instead of C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe

Got it working by uninstalling the community version for now, not very elegant tho.

Someone knows how to point node-gyp to the right MSBuild.exe?

Hi @lmbellizzi , the binding tool node-gyp does not support python3, can you try python2?

Thank you so much @kangyizhang. That was it. Also thank you @caisq.