0

The problem:

Basically I cannot manage to install the last version of tensorflow for node (npm install @tensorflow/tfjs-node).

Main concern:

which versions of node.js, node-gyp, node-pre-gyp, visual studio code and python may I use?

As the followed steps to be able to reproduce the error:

I installed visual studio community with c++ packages (2017 and 2019)

I installed python 3.10.1

node-gyp configure --msvs_version=2017

npm i -g node-gyp

npm i -g @mapbox/node-pre-gyp

Also I have tried with the following:

npm install --python=python2.7 npm config set python python2.7

however, it looks like this version of node-gyp does not support python 2.7

The error:

npm ERR! code 1
npm ERR! path C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\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.12.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.13.1 | win32 | x64
npm ERR! node-pre-gyp info check checked for "C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\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.12.0/CPU-windows-3.12.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.12.0/CPU-windows-3.12.0.zip
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/tfjs-node@3.12.0 and node@16.13.1 (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.12.0/CPU-windows-3.12.0.zip
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@16.13.1 | 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@8.4.1
npm ERR! gyp info using node@16.13.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.1 found at "C:\Users\Javi\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.28307.1759) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Users\Javi\AppData\Local\Programs\Python\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\Users\Javi\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\node_modules\@tensorflow\tfjs-node\build\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\Javi\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\Javi\AppData\Local\node-gyp\Cache\16.13.1\include\node\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\Users\Javi\AppData\Local\node-gyp\Cache\16.13.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\Users\Javi\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\Javi\\AppData\\Local\\node-gyp\\Cache\\16.13.1\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\node_modules\@tensorflow\tfjs-node',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\node_modules\@tensorflow\tfjs-node\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@16.13.1 | win32 | x64
npm ERR! gyp info spawn C:/Program Files (x86)/MSBuild/14.0/Bin
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! gyp ERR! stack Error: spawn C:/Program Files (x86)/MSBuild/14.0/Bin ENOENT
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:477:16)
npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Javi\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\node_modules\@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\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\Javi\Documents\GitHub\AI_ATest_Composer\node_modules@tensorflow\tfjs-node
npm ERR! gyp ERR! node -v v16.13.1
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! Node-gyp failed to build your package.
npm ERR! gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
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\Javi\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\node_modules@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node --module_name=tfjs_binding --module_path=C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\node_modules@tensorflow\tfjs-node\lib\napi-v8 --napi_version=8 --node_abi_napi=napi --napi_build_version=8 --node_napi_label=napi-v8' (7)
npm ERR! node-pre-gyp ERR! stack at ChildProcess. (C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\node_modules@tensorflow\tfjs-node\node_modules@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1064:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19043
npm ERR! node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\node_modules\@tensorflow\tfjs-node\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd C:\Users\Javi\Documents\GitHub\AI_ATest_Composer\node_modules@tensorflow\tfjs-node
npm ERR! node-pre-gyp ERR! node -v v16.13.1
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\Javi\AppData\Local\npm-cache_logs\2022-01-07T13_43_16_353Z-debug-0.log

What I have tried:

I am almost sure it must be a problem with versions and I tried different combinations.

I tried with visual studio code 2015, 2017 and 2019. (2019 gives me an error while trying to node-gyp configure --msvs_version=2019). Also with the last version of node-gyp and the 3.8.0 since in some post I read it worked for somebody, also I tried with deprecated version of node-pre-gyp as well as the last version of @mapbox/node-pre-gyp. All this in node 16.13.1.

In other versions of node I also tried having the visual studio of 2015 with python 2.7 since in some posts it appears like a possible solution.

At the moment I even do not know how many other things I tried since I have been trying out things for two weeks. Finally, I decided to make this post to seek for some help.

System information:

-Windows 10 x64
-node version 16.13.1 (the current recommended in node js webpage)
-visual studio community 2017 and 2019 installed
-python version 2.7 and 3.10.1 installed
-@tensorflow/tfjs 3.12.0
-@mapbox/node-pre-gyp 1.0.8
-node-gyp 8.4.1
Javiagu13
  • 26
  • 6

1 Answers1

0

Apparently it seemed there was a problem with that version of tfjs-node. Downgrading it worked and also running it on ubuntu too.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Javiagu13
  • 26
  • 6