UNPKG

2.02 kBMarkdownView Raw
1# TensorFlow.js Node.js bindings Windows troubleshooting.
2
3The tfjs-node package uses the [node-gyp](https://github.com/nodejs/node-gyp) package to handle cross-compiling the C++ code required to bind TensorFlow to Node.js. This cross platform solution can be somewhat tricky on Windows platforms. This guide helps reference solutions that have been triaged through Issues on the main [tfjs repo](https://github.com/tensorflow/tfjs).
4
5
6## 'The system cannot find the patch specified' Exceptions
7
8This can happen for a variety of reasons. First, to inspect what is missing either `cd node_modules/@tensorflow/tfjs-node` or clone the [tensorflow/tfjs repo](https://github.com/tensorflow/tfjs).
9
10After `cd`'ing or cloning, run the following command (you might need node-gyp installed globablly `npm install -g node-gyp`):
11
12```sh
13node-gyp configure --verbose
14```
15
16### Missing `python2`
17
18From the verbose output, if you see something like:
19
20```sh
21gyp verb check python checking for Python executable "python2" in the PATH
22gyp verb `which` failed Error: not found: python2
23```
24
25This means that node-gyp expects a 'python2' exe somewhere in `%PATH%`. Try running this command from an Admin (elevated privilaged prompt):
26
27You can try running this from an Adminstrative prompt:
28
29```sh
30$ npm --add-python-to-path='true' --debug install --global windows-build-tools
31```
32
33### Something else?
34
35If another missing component shows up - please file an issue on [tensorflow/tfjs](https://github.com/tensorflow/tfjs/issues/new) with the output from the `node-gyp configure --verbose` command.
36
37## msbuild.exe Exceptions
38
39Check the full stack trace from `npm install` (or `yarn`) command. If you see something like:
40
41```
42gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
43```
44
45You might need to install the system tools manually. This can be done via:
46
47```
48npm install -g --production windows-build-tools
49```
50
51If that still does not work - try re-running the command above in a privileged shell.