Skip to content

Instantly share code, notes, and snippets.

@ancs21
Last active November 13, 2018 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ancs21/b35f79daa6ee90492f35d3a817a5d890 to your computer and use it in GitHub Desktop.
Save ancs21/b35f79daa6ee90492f35d3a817a5d890 to your computer and use it in GitHub Desktop.
Install tfjs-node

Please use version 8.11.3

yarn add @tensorflow/tfjs @tensorflow/tfjs-node

Error show

yarn add v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error G:\Nodejs\tensorflowjs\node-hello\node_modules\@tensorflow\tfjs-node: Command failed.
Exit code: 1
Command: node scripts/install.js
Arguments:
Directory: G:\Nodejs\tensorflowjs\node-hello\node_modules\@tensorflow\tfjs-node
Output:
* Downloading libtensorflow

* Building TensorFlow Node.js bindings
G:\Nodejs\tensorflowjs\node-hello\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 info using node-gyp@3.6.2
gyp info using node@8.11.3 | win32 | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\python.EXE", y
ou can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\Admin\AppData\Roaming\nvm\v8.11.3\node_modules\npm\node_modules\n
ode-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\Admin\AppData\Roaming\nvm\v8.11.3\node_modules\npm\node_modules\no
de-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Users\Admin\AppData\Roaming\nvm\v8.11.3\node_modules\npm\node_modules\graceful-fs\polyfills.js:284
:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
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-gy
p\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd G:\Nodejs\tensorflowjs\node-hello\node_modules\@tensorflow\tfjs-node
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

    at cp.exec (G:\Nodejs\tensorflowjs\node-hello\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 Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

How to fix it

npm install --global --production windows-build-tools

Waiting to ... Successfully installed Python 2.7

Reinstall

yarn add @tensorflow/tfjs-node

Good luck!

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