Tfjs: Error when installing `@tensorflow/tfjs-node`` on Windows platform

Created on 10 Oct 2019  路  3Comments  路  Source: tensorflow/tfjs

TensorFlow.js version

@tensorflow/[email protected] (not able to install)

Browser version

Google Chrome is up to date
Version 77.0.3865.90 (Official Build) (64-bit)

Operating System

Windows 10

Python version

2.716

npm version

6.4.1

Problem or feature request

I was trying to install ''tensorflow/tfjs'' using "npm install @tensorflow/tfjs" but following below error was produced as a result . I have tried some issues mentioned before on github regarding such errors but couldn't find a relative solution . I also tried to ask on Stack overflow but it have been 3 days and yet no response . I will be glad to have any kind of help over here .

Code to reproduce the bug / link to feature request

Error produced after using " require('@tensorflow/tfjs-node') " in node.js

D:\FYPstuff\servermaking\f_I_upoadt2>npm install -build-from-resources

@tensorflow/[email protected] install D:\FYPstuff\servermaking\f_I_upoadt2\node_modules\@tensorflow\tfjs-node
node scripts/install.js
CPU-windows-1.2.11.zip

  • Downloading libtensorflow
    [==============================] 230048/bps 100% 0.0s
    [==============================] 95258/bps 100% 0.0s
  • Building TensorFlow Node.js bindings
    node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
    node-pre-gyp WARN Using needle for node-pre-gyp https download
    node-pre-gyp WARN Tried to download(404): https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v3/1.2.11/CPU-windows-1.2.11.zip
    node-pre-gyp WARN Pre-built binaries not found for @tensorflow/[email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with
    node-gyp)
    gyp ERR! build error
    gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\12.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: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" "build" "--fallback-to-build" "--module=D:\FYPstuff\servermaking\f_I_upoadt2\node_modules\@tensorflow\tfjs-node\lib\napi-v3\tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=D:\FYPstuff\servermaking\f_I_upoadt2\node_modules\@tensorflow\tfjs-node\lib\napi-v3" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
    gyp ERR! cwd D:\FYPstuff\servermaking\f_I_upoadt2\node_modules\@tensorflow\tfjs-node
    gyp ERR! node -v v10.15.0
    gyp ERR! node-gyp -v v3.8.0
    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 build --fallback-to-build --module=D:\FYPstuff\servermaking\f_I_upoadt2\node_modules\@tensorflow\tfjs-node\lib\napi-v3\tfjs_binding.node --module_name=tfjs_binding --module_path=D:\FYPstuff\servermaking\f_I_upoadt2\node_modules\@tensorflow\tfjs-node\lib\napi-v3 --napi_version=3 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
    node-pre-gyp ERR! stack at ChildProcess. (D:\FYPstuff\servermaking\f_I_upoadt2\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
    node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
    node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
    node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
    node-pre-gyp ERR! System Windows_NT 10.0.17763
    node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\FYPstuff\servermaking\f_I_upoadt2\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd D:\FYPstuff\servermaking\f_I_upoadt2\node_modules\@tensorflow\tfjs-node
    node-pre-gyp ERR! node -v v10.15.0
    node-pre-gyp ERR! node-pre-gyp -v v0.13.0
    node-pre-gyp ERR! not ok
node.js builinstall

Most helpful comment

@Umar24129 can you install windows-build-tools and then try to install tfjs-node? Here is the instruction: https://github.com/tensorflow/tfjs/blob/master/tfjs-node/WINDOWS_TROUBLESHOOTING.md#msbuildexe-exceptions

All 3 comments

@Umar24129 can you install windows-build-tools and then try to install tfjs-node? Here is the instruction: https://github.com/tensorflow/tfjs/blob/master/tfjs-node/WINDOWS_TROUBLESHOOTING.md#msbuildexe-exceptions

@kangyizhang I am realllly sorry i couldnt reply fast and yes thanks allot my problem is solved , as per ur guidance .. it worked when i started power shell as admin and typed this command then npm install -g windows-build-tools . Big thanks ... using tensorflow my work is down to 3s instead of 13 to 15 :D
Big thanks .

Great to hear that!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RELNO picture RELNO  路  3Comments

pranayaryal picture pranayaryal  路  4Comments

ritikrishu picture ritikrishu  路  4Comments

beele picture beele  路  3Comments

KienPM picture KienPM  路  3Comments