Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when installing @tensorflow/tfjs-node #711

Closed
JonasJW opened this issue Sep 19, 2018 · 43 comments
Closed

Error when installing @tensorflow/tfjs-node #711

JonasJW opened this issue Sep 19, 2018 · 43 comments
Assignees

Comments

@JonasJW
Copy link

JonasJW commented Sep 19, 2018

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.

@caisq
Copy link
Collaborator

caisq commented Sep 20, 2018

cc @nkreeger @kangyizhang

Can you take a look?

@kangyizhang
Copy link
Contributor

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

@JonasJW
Copy link
Author

JonasJW commented Sep 21, 2018

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

@JonasJW JonasJW closed this as completed Sep 21, 2018
@lmbellizzi
Copy link

TensorFlow.js version
Browser version
Describe the problem or feature request
Error when installing `@tensorflow/tfjs-node``

I get this Error:
c:\Projetos\recogApp>npm i @tensorflow/tfjs-node

@tensorflow/tfjs-node@0.1.19 install c:\Projetos\recogApp\node_modules@tensorflow\tfjs-node
node scripts/install.js

  • Downloading libtensorflow
    [==============================] 4991989/bps 100% 0.0s
  • Building TensorFlow Node.js bindings
    c:\Projetos\recogApp\node_modules@tensorflow\tfjs-node\scripts\install.js:154
    throw new Error('node-gyp rebuild failed with: ' + err);
    ^

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Program Files (x86)\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack at Socket.stream.socket.on (internal/child_process.js:381:11)
gyp ERR! stack at Socket.emit (events.js:182:13)
gyp ERR! stack at Pipe._handle.close (net.js:611:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd c:\Projetos\recogApp\node_modules@tensorflow\tfjs-node
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

at cp.exec (c:\Projetos\recogApp\node_modules\@tensorflow\tfjs-node\scripts\install.js:154:13)
at ChildProcess.exithandler (child_process.js:296:5)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

npm WARN rollback Rolling back @types/long@3.0.32 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'c:\Projetos\recogApp\node_modules@types'
npm WARN rollback Rolling back @types/node@10.12.0 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'c:\Projetos\recogApp\node_modules@types'
npm WARN rollback Rolling back @types/webgl2@0.0.4 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'c:\Projetos\recogApp\node_modules@types'
npm WARN rollback Rolling back @types/seedrandom@2.4.27 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'c:\Projetos\recogApp\node_modules@types'
npm WARN recogApp@1.0.0 No description
npm WARN recogApp@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@0.1.19 install: node scripts/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node@0.1.19 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! C:\Users\leand\AppData\Roaming\npm-cache_logs\2018-10-27T17_53_36_046Z-debug.log

@kangyizhang
Copy link
Contributor

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

@HarryChang30
Copy link

Hello there I got this error when trying to do the npm install @tensorflow/tfjs-node

@tensorflow/tfjs-node@0.1.21 install C:\Users\ASUS\Documents\MachineLearning\Tensorflow\node_modules@tensorflow\tfjs-node

node scripts/install.js

  • Downloading libtensorflow
    [==============================] 48257/bps 100% 0.0s
  • Building TensorFlow Node.js bindings
    C:\Users\ASUS\Documents\MachineLearning\Tensorflow\node_modules@tensorflow\tfjs-node\scripts\install.js:154
    throw new Error('node-gyp rebuild failed with: ' + err);
    ^

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
gyp ERR! build error
gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\ASUS\Documents\MachineLearning\Tensorflow\node_modules@tensorflow\tfjs-node
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

at cp.exec (C:\Users\ASUS\Documents\MachineLearning\Tensorflow\node_modules\@tensorflow\tfjs-node\scripts\install.js:154:13)
at ChildProcess.exithandler (child_process.js:296:5)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\ASUS\Documents\MachineLearning\Tensorflow\package.json'
npm WARN Tensorflow No description
npm WARN Tensorflow No repository field.
npm WARN Tensorflow No README data
npm WARN Tensorflow No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@0.1.21 install: node scripts/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node@0.1.21 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! C:\Users\ASUS\AppData\Roaming\npm-cache_logs\2018-11-20T14_38_05_393Z-debug.log

I have already installed python2.7 and set the node-gyp python to version 2.7 but seems got the error.
Is there a solution for this problem ??

@kangyizhang
Copy link
Contributor

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.

@chan109
Copy link

chan109 commented Nov 21, 2018

Hello, I got this error when trying to do the npm install @tensorflow/tfjs-node on mac

@tensorflow/tfjs-node@0.1.17 install /Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node

node scripts/install.js

  • Downloading libtensorflow
    [==============================] 3423123/bps 100% 0.0s
  • Building TensorFlow Node.js bindings
    /Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/scripts/install.js:154
    throw new Error('node-gyp rebuild failed with: ' + err);
    ^

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild' ]
gyp info using node-gyp@3.6.2
gyp info using node@8.4.0 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which succeeded python2 /usr/local/bin/python2
gyp verb check python version /usr/local/bin/python2 -c "import platform; print(platform.python_version());" returned: "2.7.15\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.4.0
gyp verb command install [ '8.4.0' ]
gyp verb install input version string "8.4.0"
gyp verb install installing version: 8.4.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 8.4.0
gyp verb build dir attempting to create "build" dir: /Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/build
gyp verb build dir "build" dir needed to be created? /Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/build
gyp verb build/config.gypi creating config file
gyp sill build/config.gypi { target_defaults:
gyp sill build/config.gypi { cflags: [],
gyp sill build/config.gypi default_configuration: 'Release',
gyp sill build/config.gypi defines: [],
gyp sill build/config.gypi include_dirs: [],
gyp sill build/config.gypi libraries: [] },
gyp sill build/config.gypi variables:
gyp sill build/config.gypi { asan: 0,
gyp sill build/config.gypi coverage: false,
gyp sill build/config.gypi debug_devtools: 'node',
gyp sill build/config.gypi debug_http2: false,
gyp sill build/config.gypi debug_nghttp2: false,
gyp sill build/config.gypi force_dynamic_crt: 0,
gyp sill build/config.gypi host_arch: 'x64',
gyp sill build/config.gypi icu_data_file: 'icudt59l.dat',
gyp sill build/config.gypi icu_data_in: '../../deps/icu-small/source/data/in/icudt59l.dat',
gyp sill build/config.gypi icu_endianness: 'l',
gyp sill build/config.gypi icu_gyp_path: 'tools/icu/icu-generic.gyp',
gyp sill build/config.gypi icu_locales: 'en,root',
gyp sill build/config.gypi icu_path: 'deps/icu-small',
gyp sill build/config.gypi icu_small: true,
gyp sill build/config.gypi icu_ver_major: '59',
gyp sill build/config.gypi llvm_version: 0,
gyp sill build/config.gypi node_byteorder: 'little',
gyp sill build/config.gypi node_enable_d8: false,
gyp sill build/config.gypi node_enable_v8_vtunejit: false,
gyp sill build/config.gypi node_install_npm: true,
gyp sill build/config.gypi node_module_version: 57,
gyp sill build/config.gypi node_no_browser_globals: false,
gyp sill build/config.gypi node_prefix: '/',
gyp sill build/config.gypi node_release_urlbase: 'https://nodejs.org/download/release/',
gyp sill build/config.gypi node_shared: false,
gyp sill build/config.gypi node_shared_cares: false,
gyp sill build/config.gypi node_shared_http_parser: false,
gyp sill build/config.gypi node_shared_libuv: false,
gyp sill build/config.gypi node_shared_openssl: false,
gyp sill build/config.gypi node_shared_zlib: false,
gyp sill build/config.gypi node_tag: '',
gyp sill build/config.gypi node_use_bundled_v8: true,
gyp sill build/config.gypi node_use_dtrace: true,
gyp sill build/config.gypi node_use_etw: false,
gyp sill build/config.gypi node_use_lttng: false,
gyp sill build/config.gypi node_use_openssl: true,
gyp sill build/config.gypi node_use_perfctr: false,
gyp sill build/config.gypi node_use_v8_platform: true,
gyp sill build/config.gypi node_without_node_options: false,
gyp sill build/config.gypi openssl_fips: '',
gyp sill build/config.gypi openssl_no_asm: 0,
gyp sill build/config.gypi shlib_suffix: '57.dylib',
gyp sill build/config.gypi target_arch: 'x64',
gyp sill build/config.gypi uv_parent_path: '/deps/uv/',
gyp sill build/config.gypi uv_use_dtrace: true,
gyp sill build/config.gypi v8_enable_gdbjit: 0,
gyp sill build/config.gypi v8_enable_i18n_support: 1,
gyp sill build/config.gypi v8_enable_inspector: 1,
gyp sill build/config.gypi v8_no_strict_aliasing: 1,
gyp sill build/config.gypi v8_optimized_debug: 0,
gyp sill build/config.gypi v8_promise_internal_field_count: 1,
gyp sill build/config.gypi v8_random_seed: 0,
gyp sill build/config.gypi v8_trace_maps: 0,
gyp sill build/config.gypi v8_use_snapshot: false,
gyp sill build/config.gypi want_separate_host_toolset: 0,
gyp sill build/config.gypi want_separate_host_toolset_mkpeephole: 0,
gyp sill build/config.gypi xcode_version: '7.0',
gyp sill build/config.gypi nodedir: '/Users/chanhaokun/.node-gyp/8.4.0',
gyp sill build/config.gypi standalone_static_library: 1,
gyp sill build/config.gypi save_dev: '',
gyp sill build/config.gypi legacy_bundling: '',
gyp sill build/config.gypi dry_run: '',
gyp sill build/config.gypi viewer: 'man',
gyp sill build/config.gypi only: '',
gyp sill build/config.gypi browser: '',
gyp sill build/config.gypi also: '',
gyp sill build/config.gypi rollback: 'true',
gyp sill build/config.gypi usage: '',
gyp sill build/config.gypi globalignorefile: '/usr/local/etc/npmignore',
gyp sill build/config.gypi shell: '/bin/zsh',
gyp sill build/config.gypi maxsockets: '50',
gyp sill build/config.gypi init_author_url: '',
gyp sill build/config.gypi shrinkwrap: 'true',
gyp sill build/config.gypi parseable: '',
gyp sill build/config.gypi metrics_registry: 'https://registry.npmjs.org/',
gyp sill build/config.gypi timing: '',
gyp sill build/config.gypi init_license: 'ISC',
gyp sill build/config.gypi if_present: '',
gyp sill build/config.gypi sign_git_tag: '',
gyp sill build/config.gypi init_author_email: '',
gyp sill build/config.gypi cache_max: 'Infinity',
gyp sill build/config.gypi long: '',
gyp sill build/config.gypi local_address: '',
gyp sill build/config.gypi git_tag_version: 'true',
gyp sill build/config.gypi cert: '',
gyp sill build/config.gypi registry: 'https://registry.npmjs.org/',
gyp sill build/config.gypi fetch_retries: '2',
gyp sill build/config.gypi versions: '',
gyp sill build/config.gypi message: '%s',
gyp sill build/config.gypi key: '',
gyp sill build/config.gypi globalconfig: '/usr/local/etc/npmrc',
gyp sill build/config.gypi prefer_online: '',
gyp sill build/config.gypi logs_max: '10',
gyp sill build/config.gypi always_auth: '',
gyp sill build/config.gypi global_style: '',
gyp sill build/config.gypi cache_lock_retries: '10',
gyp sill build/config.gypi heading: 'npm',
gyp sill build/config.gypi searchlimit: '20',
gyp sill build/config.gypi proprietary_attribs: 'true',
gyp sill build/config.gypi offline: '',
gyp sill build/config.gypi fetch_retry_mintimeout: '10000',
gyp sill build/config.gypi json: '',
gyp sill build/config.gypi access: '',
gyp sill build/config.gypi allow_same_version: '',
gyp sill build/config.gypi https_proxy: '',
gyp sill build/config.gypi engine_strict: '',
gyp sill build/config.gypi description: 'true',
gyp sill build/config.gypi userconfig: '/Users/chanhaokun/.npmrc',
gyp sill build/config.gypi init_module: '/Users/chanhaokun/.npm-init.js',
gyp sill build/config.gypi user: '',
gyp sill build/config.gypi node_version: '8.4.0',
gyp sill build/config.gypi save: 'true',
gyp sill build/config.gypi ignore_prepublish: '',
gyp sill build/config.gypi editor: 'vi',
gyp sill build/config.gypi auth_type: 'legacy',
gyp sill build/config.gypi tag: 'latest',
gyp sill build/config.gypi script_shell: '',
gyp sill build/config.gypi progress: 'true',
gyp sill build/config.gypi global: '',
gyp sill build/config.gypi searchstaleness: '900',
gyp sill build/config.gypi optional: 'true',
gyp sill build/config.gypi ham_it_up: '',
gyp sill build/config.gypi save_prod: '',
gyp sill build/config.gypi force: '',
gyp sill build/config.gypi bin_links: 'true',
gyp sill build/config.gypi searchopts: '',
gyp sill build/config.gypi depth: 'Infinity',
gyp sill build/config.gypi sso_poll_frequency: '500',
gyp sill build/config.gypi rebuild_bundle: 'true',
gyp sill build/config.gypi unicode: 'true',
gyp sill build/config.gypi fetch_retry_maxtimeout: '60000',
gyp sill build/config.gypi tag_version_prefix: 'v',
gyp sill build/config.gypi strict_ssl: 'true',
gyp sill build/config.gypi sso_type: 'oauth',
gyp sill build/config.gypi scripts_prepend_node_path: 'warn-only',
gyp sill build/config.gypi save_prefix: '^',
gyp sill build/config.gypi ca: '',
gyp sill build/config.gypi save_exact: '',
gyp sill build/config.gypi group: '20',
gyp sill build/config.gypi fetch_retry_factor: '10',
gyp sill build/config.gypi dev: '',
gyp sill build/config.gypi version: '',
gyp sill build/config.gypi prefer_offline: '',
gyp sill build/config.gypi cache_lock_stale: '60000',
gyp sill build/config.gypi cache_min: '10',
gyp sill build/config.gypi searchexclude: '',
gyp sill build/config.gypi cache: '/Users/chanhaokun/.npm',
gyp sill build/config.gypi color: 'true',
gyp sill build/config.gypi package_lock: 'true',
gyp sill build/config.gypi save_optional: '',
gyp sill build/config.gypi ignore_scripts: '',
gyp sill build/config.gypi user_agent: 'npm/5.3.0 node/v8.4.0 darwin x64',
gyp sill build/config.gypi cache_lock_wait: '10000',
gyp sill build/config.gypi production: '',
gyp sill build/config.gypi send_metrics: '',
gyp sill build/config.gypi save_bundle: '',
gyp sill build/config.gypi umask: '0022',
gyp sill build/config.gypi init_version: '1.0.0',
gyp sill build/config.gypi init_author_name: '',
gyp sill build/config.gypi git: 'git',
gyp sill build/config.gypi scope: '',
gyp sill build/config.gypi unsafe_perm: 'true',
gyp sill build/config.gypi tmp: '/var/folders/bn/k2n8nl7j6x10hf1dcx0k3n300000gn/T',
gyp sill build/config.gypi onload_script: '',
gyp sill build/config.gypi prefix: '/usr/local',
gyp sill build/config.gypi link: '' } }
gyp verb build/config.gypi writing out config file: /Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/build/config.gypi
gyp verb config.gypi checking for gypi file: /Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/config.gypi
gyp verb common.gypi checking for gypi file: /Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/local/bin/python2
gyp info spawn args [ '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/chanhaokun/.node-gyp/8.4.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/chanhaokun/.node-gyp/8.4.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/chanhaokun/.node-gyp/8.4.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /Users/chanhaokun/.node-gyp/8.4.0
gyp verb which succeeded for make /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
internal/util.js:206
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'original', 'function');
^

TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function
at Object.promisify (internal/util.js:206:11)
at Object. (/Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/scripts/deps-stage.js:21:19)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:598:3
make: *** [Release/libtensorflow.so] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 18.0.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/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node
gyp ERR! node -v v8.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

at cp.exec (/Users/chanhaokun/Documents/Project/ml_Course/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/scripts/install.js:154:13)
at ChildProcess.exithandler (child_process.js:277:5)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:927:16)
at Socket.stream.socket.on (internal/child_process.js:348:11)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at Pipe._handle.close [as _onclose] (net.js:545:12)

npm WARN knn-tf@1.0.0 No description
npm WARN knn-tf@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/chanhaokun/.npm/_logs/2018-11-21T00_59_58_913Z-debug.log

Any helps will be appreciated!

@chan109
Copy link

chan109 commented Nov 21, 2018

Never mind. I updated my node to the latest version and it makes things to work.

@HarryChang30
Copy link

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.

Thanks for the solution. It works now @kangyizhang

@OracleLurker
Copy link

Hi - Any Idea? I did install the windows build tools, initially had python 3.7 installed but have now uninstalled it and set the python path to python2.7 and and there are no spaces in the directory names.

C:\TensorFlowModeling>npm install @tensorflow/tfjs-node

@tensorflow/tfjs-node@0.1.21 install C:\TensorFlowModeling\node_modules@tensorflow\tfjs-node
node scripts/install.js

  • Downloading libtensorflow
    [==============================] 25073331/bps 98% 0.0s
  • Building TensorFlow Node.js bindings
    C:\TensorFlowModeling\node_modules@tensorflow\tfjs-node\scripts\install.js:154
    throw new Error('node-gyp rebuild failed with: ' + err);
    ^

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\TensorFlowModeling\node_modules@tensorflow\tfjs-node
gyp ERR! node -v v11.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

at cp.exec (C:\TensorFlowModeling\node_modules\@tensorflow\tfjs-node\scripts\install.js:154:13)
at ChildProcess.exithandler (child_process.js:301:5)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:978:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)

npm WARN enoent ENOENT: no such file or directory, open 'C:\TensorFlowModeling\package.json'
npm WARN TensorFlowModeling No description
npm WARN TensorFlowModeling No repository field.
npm WARN TensorFlowModeling No README data
npm WARN TensorFlowModeling No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@0.1.21 install: node scripts/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node@0.1.21 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! C:\Users\Chris\AppData\Roaming\npm-cache_logs\2018-11-24T20_25_28_918Z-debug.log

C:\TensorFlowModeling>npm install @tensorflow/tfjs-node

@tensorflow/tfjs-node@0.1.21 install C:\TensorFlowModeling\node_modules@tensorflow\tfjs-node
node scripts/install.js

  • Downloading libtensorflow
    [==============================] 25687950/bps 99% 0.0s
  • Building TensorFlow Node.js bindings
    C:\TensorFlowModeling\node_modules@tensorflow\tfjs-node\scripts\install.js:154
    throw new Error('node-gyp rebuild failed with: ' + err);
    ^

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\TensorFlowModeling\node_modules@tensorflow\tfjs-node
gyp ERR! node -v v11.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

at cp.exec (C:\TensorFlowModeling\node_modules\@tensorflow\tfjs-node\scripts\install.js:154:13)
at ChildProcess.exithandler (child_process.js:301:5)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:978:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)

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

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@0.1.21 install: node scripts/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node@0.1.21 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! C:\Users\Chris\AppData\Roaming\npm-cache_logs\2018-11-24T20_26_39_395Z-debug.log

@nkreeger
Copy link
Contributor

gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1

This is because the win tools are not installed properly.

Can you retry npm install --production windows-build-tools - you might have to do this from a privileged prompt.

@Shadowstep33
Copy link

@nkreeger I tried the npm install --production windows-build-tools step twice. The only difference between when it worked and didn't was adding the global flag so make sure y'all try:

npm -g install --production windows-build-tools

@nkreeger
Copy link
Contributor

@Shadowstep33 thanks updated the README for windows troubleshooting.

@ghost
Copy link

ghost commented Dec 20, 2018

Try to install again with --force option:

npm install --force
If this doesn't work try to update npm globally:

npm update -g npm
and try again with the --force option.

else

Config python:

npm config set python /path/to/python2.7
Config msvs_version:

npm config set msvs_version 2013
Run a npm install or the npm command which occurs this error. It works for me!

@Mwni
Copy link

Mwni commented Dec 29, 2018

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?

@conorpo
Copy link

conorpo commented Feb 2, 2019

cc @kangyizhang
Can you help me out im having a similair issue but none of the fixes worked. I'm not good at formatting
so everything between the dashed lines is console output


Conor@DESKTOP-FBFEHQO MINGW64 /d/Coding/ML/tf/first
$ npm install @tensorflow/tfjs-node-gpu

@tensorflow/tfjs-node-gpu@0.2.3 install D:\Coding\ML\tf\first\node_modules@tensorflow\tfjs-node-gpu
node scripts/install.js gpu download

  • Downloading libtensorflow
    [==============================] 13907536/bps 100% 0.0s
  • Building TensorFlow Node.js bindings
    D:\Coding\ML\tf\first\node_modules@tensorflow\tfjs-node-gpu\scripts\install.js:171
    throw new Error('node-gyp rebuild failed with: ' + err);
    ^

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Coding\ML\tf\first\node_modules@tensorflow\tfjs-node-gpu
gyp ERR! node -v v11.9.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

at cp.exec (D:\Coding\ML\tf\first\node_modules\@tensorflow\tfjs-node-gpu\scripts\install.js:171:13)
at ChildProcess.exithandler (child_process.js:304:5)
at ChildProcess.emit (events.js:197:13)
at maybeClose (internal/child_process.js:978:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)

npm WARN rollback Rolling back @types/node@10.12.21 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'D:\Coding\ML\tf\first\node_modules@types'
npm WARN rollback Rolling back @types/seedrandom@2.4.27 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'D:\Coding\ML\tf\first\node_modules@types'
npm WARN rollback Rolling back @types/node-fetch@2.1.4 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'D:\Coding\ML\tf\first\node_modules@types'
npm WARN rollback Rolling back @types/webgl-ext@0.0.30 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'D:\Coding\ML\tf\first\node_modules@types'
npm WARN rollback Rolling back @types/webgl2@0.0.4 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'D:\Coding\ML\tf\first\node_modules@types'
npm WARN first@1.0.0 No description
npm WARN first@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node-gpu@0.2.3 install: node scripts/install.js gpu download
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node-gpu@0.2.3 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! C:\Users\Conor\AppData\Roaming\npm-cache_logs\2019-02-02T02_41_53_437Z-debug.log


@kangyizhang
Copy link
Contributor

hi @conorpo

For most cases with error Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe on windows, reinstall window build tool would fix it (https://github.com/tensorflow/tfjs-node/blob/master/WINDOWS_TROUBLESHOOTING.md).

Also, you could try to download the @tensorflow/tfjs-node-gpu repo and run yarn install and if it's not working please paste the error here.

@conorpo
Copy link

conorpo commented Feb 3, 2019

I reinstalled The Build Tools as a global npm module but I still get the same error, just with a different path.

@conorpo
Copy link

conorpo commented Feb 3, 2019

@kangyizhang
The latest version of windows build tools just says failed to install windows build tools. According to a thread only 4.0.0 works. I tried both installing it in the local node_modules and globally, neither worked.

@jesseragos
Copy link

jesseragos commented Feb 6, 2019

Hi, anyone there who can help me with this error log?
Here is a complete log for more details 2019-02-06T15_45_05_022Z-debug.log

UPDATE: npm install --production windows-build-tools doesn't seem to apply for me as for the possible fix from previous comments. This included a complete log with sort of similarities from the main issue
2019-02-06T16_34_07_850Z-debug.log


$ npm install @tensorflow/tfjs-node

> @tensorflow/tfjs-node@0.2.3 install C:\Users\Jessekiel\Desktop\MLKits\knn-tf\node_modules\@tensorflow\tfjs-node
> node scripts/install.js

* Downloading libtensorflow
[============================] 485730/bps 100% 0.0s
* Building TensorFlow Node.js bindings
C:\Users\Jessekiel\Desktop\MLKits\knn-tf\node_modules\@tensorflow\tfjs-node\scripts\install.js:171
      throw new Error('node-gyp rebuild failed with: ' + err);
      ^

Error: node-gyp rebuild failed with: Error: Command
failed: node-gyp rebuild
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Jessekiel\Desktop\MLKits\knn-tf\node_modules\@tensorflow\tfjs-node
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

    at cp.exec (C:\Users\Jessekiel\Desktop\MLKits\knn-tf\node_modules\@tensorflow\tfjs-node\scripts\install.js:171:13)
    at ChildProcess.exithandler (child_process.js:301:5)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)    at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
npm WARN knn-tf@1.0.0 No description
npm WARN knn-tf@1.0.0 No repository field.

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

@conorpo
Copy link

conorpo commented Feb 11, 2019

@kangyizhang When I attempt to install windows build tools globally via npm I get this error

Downloading vs_BuildTools.exe
[============================================>] 100.0% of 1.12 MB (1.12 MB/s)
Downloaded vs_BuildTools.exe. Saved to C:\Users\Conor.windows-build-tools\vs_BuildTools.exe.

Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!

Status from the installers:
---------- Visual Studio Build Tools ----------
2019-02-11T16:17:18 : Verbose : [InstalledProductsProviderImpl]: Stream was closed
2019-02-11T16:17:18 : Verbose : [InstallerImpl]: Rpc connection was closed.
2019-02-11T16:17:18 : Verbose : [InstallerImpl]: Stream was closed
2019-02-11T16:17:18 : Verbose : [SetupUpdaterImpl]: Rpc connection was closed.
2019-02-11T16:17:18 : Verbose : [SetupUpdaterImpl]: Stream was closed
------------------- Python --------------------
Python 2.7.15 is already installed, not installing again.

Could not install Visual Studio Build Tools.
Please find more details in the log files, which can be found at
C:\Users\Conor.windows-build-tools

Skipping configuration: No configuration for Python or Visual Studio Build Tools required.
TypeError: Cannot read property 'then' of undefined
at install_1.install (C:\Program Files\nodejs\node_modules\windows-build-tools\dist\start.js:19:17)
at launch_1.launchInstaller.then.then.then (C:\Program Files\nodejs\node_modules\windows-build-tools\dist\install\index.js:34:9)
at processTicksAndRejections (internal/process/next_tick.js:81:5)

  • windows-build-tools@5.1.0
    updated 1 package in 6.025s

The log file is not there

@kangyizhang
Copy link
Contributor

hi @conorpo

Can you check if you have microsoft visual studio installed? The error seems to be related with windows environment setup.

@conorpo
Copy link

conorpo commented Feb 12, 2019

@kangyizhang According to the visual studio installer I have the following installed : Visual Studio Community 2017 (2) and Visual Studio Build Tools 2017

@ahmadalibaloch
Copy link

Worked after uninstalling python 3 and running npm install --production windows-build-tools, which installs python 2 and then running yarn add @tensorflow/tfjs-node.

@buzaXnov
Copy link

Try to install again with --force option:

npm install --force
If this doesn't work try to update npm globally:

npm update -g npm
and try again with the --force option.

else

Config python:

npm config set python /path/to/python2.7
Config msvs_version:

npm config set msvs_version 2013
Run a npm install or the npm command which occurs this error. It works for me!

This has resolved my issue. Simply installing Python 2.7 for Windows and setting the path to it. No more errors. I suppose this will work on my machine w/ Linux installed.

@BilalReffas
Copy link

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

Thanks! @lmbellizzi

@forrestblade
Copy link

forrestblade commented Jun 26, 2019

Trying to install this on a ChromeOS Crostini container with python2.7 installed and on node 11.15 I get this same error. Any ideas?
EDIT: I don't have any spaces in my directory name. The installation appears to fail on the "rebuild" step.

@maanmuca
Copy link

maanmuca commented Jan 1, 2020

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?

I upgraded the version of Visual studio to 2019 and after I restarted windows , then I ran npm install --production windows-build-tools as admin , and the installation of tensorflow worked to me!

@sasiprojs
Copy link

I am getting the following error in ubuntu 20.04

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-v5/1.7.4/CPU-linux-1.7.4.tar.gz
node-pre-gyp WARN Pre-built binaries not found for @tensorflow/tfjs-node@1.7.4 and node@10.20.1 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Linux 5.4.0-26-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/sasikanth/Documents/nVipani/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=/home/sasikanth/Documents/nVipani/node_modules/@tensorflow/tfjs-node/lib/napi-v5" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=5" "--node_napi_label=napi-v5"
gyp ERR! cwd /home/sasikanth/Documents/nVipani/node_modules/@tensorflow/tfjs-node
gyp ERR! node -v v10.20.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/sasikanth/Documents/nVipani/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node --module_name=tfjs_binding --module_path=/home/sasikanth/Documents/nVipani/node_modules/@tensorflow/tfjs-node/lib/napi-v5 --napi_version=6 --node_abi_napi=napi --napi_build_version=5 --node_napi_label=napi-v5' (1)
node-pre-gyp ERR! stack at ChildProcess. (/home/sasikanth/Documents/nVipani/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 Linux 5.4.0-26-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/sasikanth/Documents/nVipani/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/sasikanth/Documents/nVipani/node_modules/@tensorflow/tfjs-node
node-pre-gyp ERR! node -v v10.20.1
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok

@VirajSingh19
Copy link

I'm getting following error in ubuntu 18.04
CPU-linux-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 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/1.7.4/CPU-linux-1.7.4.tar.gz
    node-pre-gyp WARN Pre-built binaries not found for @tensorflow/tfjs-node@1.7.4 and node@10.20.1 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
    make: g++: Command not found
    make: *** [Release/obj.target/tfjs_binding/binding/tfjs_backend.o] Error 127
    gyp ERR! build error
    gyp ERR! stack Error: make failed with exit code: 2
    gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:191:23)
    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 Linux 5.3.0-26-generic
    gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/lib/napi-v5" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=5" "--node_napi_label=napi-v5"
    gyp ERR! cwd /home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node
    gyp ERR! node -v v10.20.1
    gyp ERR! node-gyp -v v5.1.0
    gyp ERR! not ok
    node-pre-gyp ERR! build error
    node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node --module_name=tfjs_binding --module_path=/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/lib/napi-v5 --napi_version=6 --node_abi_napi=napi --napi_build_version=5 --node_napi_label=napi-v5' (1)
    node-pre-gyp ERR! stack at ChildProcess. (/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/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 Linux 5.3.0-26-generic
    node-pre-gyp ERR! command "/usr/bin/node" "/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd /home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node
    node-pre-gyp ERR! node -v v10.20.1
    node-pre-gyp ERR! node-pre-gyp -v v0.14.0
    node-pre-gyp ERR! not ok

@tensorflow/tfjs-node@1.7.4 /home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node
dummylap-911@dummylap911-ThinkPad-L490:~/Documents/MLKits/knn-tf$ sudo npm --unsafe-perm rebuild @tensorflow/tfjs-node build-addon-from-source

@tensorflow/tfjs-node@1.7.4 install /home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node
node scripts/install.js

CPU-linux-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 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/1.7.4/CPU-linux-1.7.4.tar.gz
    node-pre-gyp WARN Pre-built binaries not found for @tensorflow/tfjs-node@1.7.4 and node@10.20.1 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
    make: g++: Command not found
    make: *** [Release/obj.target/tfjs_binding/binding/tfjs_backend.o] Error 127
    gyp ERR! build error
    gyp ERR! stack Error: make failed with exit code: 2
    gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:191:23)
    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 Linux 5.3.0-26-generic
    gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/lib/napi-v5" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=5" "--node_napi_label=napi-v5"
    gyp ERR! cwd /home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node
    gyp ERR! node -v v10.20.1
    gyp ERR! node-gyp -v v5.1.0
    gyp ERR! not ok
    node-pre-gyp ERR! build error
    node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node --module_name=tfjs_binding --module_path=/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/lib/napi-v5 --napi_version=6 --node_abi_napi=napi --napi_build_version=5 --node_napi_label=napi-v5' (1)
    node-pre-gyp ERR! stack at ChildProcess. (/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/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 Linux 5.3.0-26-generic
    node-pre-gyp ERR! command "/usr/bin/node" "/home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd /home/dummylap-911/Documents/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node
    node-pre-gyp ERR! node -v v10.20.1
    node-pre-gyp ERR! node-pre-gyp -v v0.14.0
    node-pre-gyp ERR! not ok

@SmitVavliya
Copy link

@tensorflow/tfjs-node@1.5.1 build-addon-from-source D:\TESA\tfjs-test\part2\node_modules@tensorflow\tfjs-node
node-pre-gyp install --build-from-source

node-pre-gyp WARN Using needle for node-pre-gyp https download
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:302:5)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--build-from-source" "--module=D:\TESA\tfjs-test\part2\node_modules\@tensorflow\tfjs-node\lib\napi-v5\tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=D:\TESA\tfjs-test\part2\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 D:\TESA\tfjs-test\part2\node_modules@tensorflow\tfjs-node
gyp ERR! node -v v12.14.0
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 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --build-from-source --module=D:\TESA\tfjs-test\part2\node_modules@tensorflow\tfjs-node\lib\napi-v5\tfjs_binding.node --module_name=tfjs_binding --module_path=D:\TESA\tfjs-test\part2\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. (D:\TESA\tfjs-test\part2\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:210:5)
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 Windows_NT 10.0.18363
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\TESA\tfjs-test\part2\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--build-from-source"
node-pre-gyp ERR! cwd D:\TESA\tfjs-test\part2\node_modules@tensorflow\tfjs-node
node-pre-gyp ERR! node -v v12.14.0
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --build-from-source --module=D:\TESA\tfjs-test\part2\node_modules@tensorflow\tfjs-node\lib\napi-v5\tfjs_binding.node --module_name=tfjs_binding --module_path=D:\TESA\tfjs-test\part2\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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@1.5.1 build-addon-from-source: node-pre-gyp install --build-from-source
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node@1.5.1 build-addon-from-source 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! C:\Users\Kittisak\AppData\Roaming\npm-cache_logs\2020-01-17T03_39_18_828Z-debug.log

@SmitVavliya
Copy link

how to slove this error.please help me.

@kangyizhang
Copy link
Contributor

@smit12345 you need to install visual studio to compile the bindings in this library.

@Nisthar
Copy link

Nisthar commented Mar 25, 2021

any update on this?

@VemulaPaavanaSaiKumar18
Copy link

$ npm install @tensorflow/tfjs-node
npm ERR! code 1
npm ERR! path D:\js code\Body pix\node_modules@tensorflow\tfjs-node
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/install.js
npm ERR! CPU-windows-3.14.0.zip
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.7.0.zip
npm ERR! node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.4
npm ERR! node-pre-gyp info using node@16.14.0 | win32 | x64
npm ERR! node-pre-gyp info check checked for "D:\js code\Body pix\node_modules@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node" (not found)
npm ERR! node-pre-gyp http GET https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.14.0/CPU-windows-3.14.0.zip
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.14.0/CPU-windows-3.14.0.zip
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/tfjs-node@3.14.0 and node@16.14.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.14.0/CPU-windows-3.14.0.zip
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.14.0 | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.14.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.2 found at "C:\Python310\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2019 (16.11.32106.194) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS checking VS2017 (15.9.28307.1274) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - found VC++ toolset: v141
npm ERR! gyp ERR! find VS - missing any Windows SDK
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\91636\AppData\Roaming\nvm\v16.14.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack at C:\Users\91636\AppData\Roaming\nvm\v16.14.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\91636\AppData\Roaming\nvm\v16.14.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
npm ERR! gyp ERR! stack at C:\Users\91636\AppData\Roaming\nvm\v16.14.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack at C:\Users\91636\AppData\Roaming\nvm\v16.14.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:16
npm ERR! gyp ERR! stack at C:\Users\91636\AppData\Roaming\nvm\v16.14.0\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack at C:\Users\91636\AppData\Roaming\nvm\v16.14.0\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:406:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
npm ERR! gyp ERR! System Windows_NT 10.0.22563
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\91636\AppData\Roaming\nvm\v16.14.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=D:\js code\Body pix\node_modules\@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=D:\js code\Body pix\node_modules\@tensorflow\tfjs-node\lib\napi-v8" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=8" "--node_napi_label=napi-v8"
npm ERR! gyp ERR! cwd D:\js code\Body pix\node_modules@tensorflow\tfjs-node
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\91636\AppData\Roaming\nvm\v16.14.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=D:\js code\Body pix\node_modules@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node --module_name=tfjs_binding --module_path=D:\js code\Body pix\node_modules@tensorflow\tfjs-node\lib\napi-v8 --napi_version=8 --node_abi_napi=napi --napi_build_version=8 --node_napi_label=napi-v8' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess. (D:\js code\Body pix\node_modules@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.22563
npm ERR! node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\js code\Body pix\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd D:\js code\Body pix\node_modules@tensorflow\tfjs-node
npm ERR! node-pre-gyp ERR! node -v v16.14.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.4
npm ERR! node-pre-gyp ERR! not ok
npm ERR! * Downloading libtensorflow
npm ERR!
npm ERR! * Building TensorFlow Node.js bindings

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\91636\AppData\Local\npm-cache_logs\2022-03-06T17_34_43_707Z-debug-0.log

@VemulaPaavanaSaiKumar18
Copy link

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

@LemonCANDY42
Copy link

same quesion

@ozio
Copy link

ozio commented May 13, 2022

saaaame

@ErrorBot1122
Copy link

I get this same issue when trying to install puppeteer-hcaptcha which installs @tensorflow/tfjs-node

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

> @tensorflow/tfjs-node@3.18.0 install /home/runner/Puppeteer-Test-1/node_modules/@tensorflow/tfjs-node
> node scripts/install.js

CPU-linux-3.18.0.tar.gz
* Downloading libtensorflow
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.7.0.tar.gz
[========================      ] 8279291/bps 81% 2.2sevents.js:352
      throw er; // Unhandled 'error' event
      ^

Error: Unknown system error -122: Unknown system error -122, write
Emitted 'error' event on Unpack instance at:
    at Unpack.onerror (internal/streams/readable.js:745:14)
    at Unpack.emit (events.js:375:28)
    at Unpack.warn (/home/runner/Puppeteer-Test-1/node_modules/tar/lib/warn-mixin.js:7:12)
    at Unpack.[onError] (/home/runner/Puppeteer-Test-1/node_modules/tar/lib/unpack.js:325:12)
    at WriteStream.<anonymous> (/home/runner/Puppeteer-Test-1/node_modules/tar/lib/unpack.js:381:20)
    at WriteStream.emit (events.js:375:28)
    at WriteStream.[_onerror] (/home/runner/Puppeteer-Test-1/node_modules/tar/node_modules/fs-minipass/index.js:234:10)
    at WriteStream.[_onwrite] (/home/runner/Puppeteer-Test-1/node_modules/tar/node_modules/fs-minipass/index.js:296:21)
    at /home/runner/Puppeteer-Test-1/node_modules/tar/node_modules/fs-minipass/index.js:291:21
    at FSReqCallback.wrapper [as oncomplete] (fs.js:660:5) {
  errno: -122,
  code: 'Unknown system error -122',
  syscall: 'write'
}
npm WARN runner@1.0.0 No description
npm WARN runner@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@3.18.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @tensorflow/tfjs-node@3.18.0 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!     /home/runner/.npm/_logs/2022-05-24T18_37_21_281Z-debug.log

Mor info here

@Sheikh24608
Copy link

devs alive?

@somnathChaturvedi
Copy link

@Oluwapelumi154
Copy link

I'm having this issue after installing python2.7 and @tensorflow/tfjs-node

How do i resolve this ?

C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api>npm i @tensorflow/tfjs-node
npm ERR! code 1
npm ERR! path C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api\node_modules@tensorflow\tfjs-node
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d/s/c node scripts/install.js
npm ERR! CPU-windows-4.2.0.zip
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.9.1.zip
npm ERR! node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.9
npm ERR! node-pre-gyp info using node@18.12.0 | win32 | x64
npm ERR! node-pre-gyp info check checked for "C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api\node_modules@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node" (not found)
npm ERR! node-pre-gyp http GET https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.2.0/CPU-windows-4.2.0.zip
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.2.0/CPU-windows-4.2.0.zip
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/tfjs-node@4.2.0 and node@18.12.0 (node-v108 ABI, unknown) (falling back to
source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.2.0/CPU-windows-4.2.0.zip
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@18.12.0 | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@18.12.0 | win32 | x64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if Python is C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python39\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python39\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python38\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python38\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python37\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python37\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python37\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python36\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python36\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python36\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\Orebayo Oluwapelumi\AppData\Local\Programs\Python\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if the py launcher can be used to find Python 3
npm ERR! gyp ERR! find Python - "py.exe" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python npm config set python "C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:330:47)
npm ERR! gyp ERR! stack at PythonFinder.runChecks (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:159:21)
npm ERR! gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:228:18)
npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:294:16)
npm ERR! gyp ERR! stack at exithandler (node:child_process:420:5)
npm ERR! gyp ERR! stack at ChildProcess.errorhandler (node:child_process:432:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:289:12)
npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:476:16)
npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js"
"configure" "--fallback-to-build" "--module=C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api\node_modules\@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api\node_modules\@tensorflow\tfjs-node\lib\napi-v8" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=8" "--node_napi_label=napi-v8"
npm ERR! gyp ERR! cwd C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api\node_modules@tensorflow\tfjs-node
npm ERR! gyp ERR! node -v v18.12.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api\node_modules@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node --module_name=tfjs_binding --module_path=C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api\node_modules@tensorflow\tfjs-node\lib\napi-v8 --napi_version=8 --node_abi_napi=napi --napi_build_version=8 --node_napi_label=napi-v8' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess. (C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api\node_modules@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
npm ERR! node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19045
npm ERR! node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd C:\Users\Orebayo Oluwapelumi\Desktop\brain-tumor-api\node_modules@tensorflow\tfjs-node
npm ERR! node-pre-gyp ERR! node -v v18.12.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.9
npm ERR! node-pre-gyp ERR! not ok
npm ERR! * Downloading libtensorflow
npm ERR!
npm ERR! * Building TensorFlow Node.js bindings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests