tfjs: Can't install tfjs-node or tfjs-node-gpu on Windows 10

To get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.

TensorFlow.js version

I have tried several version: Latest Stable 1.5.1, 1.3.1, 1.2.7, 1.2.6 of tfjs-node and tfjs-node-gpu (tried individually and tried installing both together)

Browser version

Node Version 10.16.3

Describe the problem or feature request

I have spent the past 3 days trying to install the tfjs-node and tfjs-node-gpu packages via NPM on Windows 10 machine (new).

I have followed the complete install instructions provided both on the Tensorflow JS documentation site and NPM package website. I have Visual Studio 2017 installed (I also tried with Visual Studio 2015), with the relevant C++ components and 2015 Build tools. I have updated my gpu driver, made sure CUDA compatabile, CUDA 10 installed fine and linked to visual studio, with cuDNN 7.4.1 as well. I also have python 2.7 installed instead of 3.x as suggsted. Each time I tried a new process or fix I uninstalled everything to start a fresh.

The standard front-end tfjs package installs and runs fine. It is only the tfjs-node and tfjs-node-gpu that has major problems.

I have tried with previous versions etc, I have tried the full build from source option as well, as described here: https://www.npmjs.com/package/@tensorflow/tfjs-node with Bazel.

I have used previous versions of the tfjs-node package, namely 1.2.8 as suggested in another issue (https://github.com/tensorflow/tfjs/issues/1912).

I have tried going into the node_module/@tensorflow/tfjs-node and run node-gyp configure.

Code to reproduce the bug / link to feature request

Here is a process of the latest attempt I tried (since bazel build failed as well):

Uninstall everything and remove environment variables that were added in previous steps.

Go through installation procedure installing visual studio 2017, windows build tools, CUDA 10, cuDNN 7.4.1. All fine so far.

Node version is: 64bit windows v10.16.3 (as recommended)

run cmd.exe as administrator

npm install @tensorflow/tfjs-node@1.2.7 (installs OK) npm install @tensorflow/tfjs-node-gpu@1.2.7 (installs OK)

Then, attempting to lift my node application I get following error:

Error: A dynamic link library (DLL) initialization routine failed. \\?\C:\wamp64\www\test\node_modules\@tensorflow\tfjs-node\lib\napi-v4\tfjs_binding.node at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (C:\wamp64\www\test\node_modules\@tensorflow\tfjs-node\dist\index.js:44:16) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (C:\wamp64\www\test\api\services\TensorFlow.js:10:1) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18)

So at this point, I move on to try and build inside the node_module folder as such:

cd C:\wamp64\www\test\node_modules@tensorflow\tfjs-node npm install

@tensorflow/tfjs-node@1.2.7 install C:\wamp64\www\test\node_modules\@tensorflow\tfjs-node node scripts/install.js

CPU-windows-1.2.7.zip
* Building TensorFlow Node.js bindings
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN @tensorflow/tfjs-node@1.2.7 No license field.

added 335 packages from 223 contributors and audited 731 packages in 42.008s
found 7 vulnerabilities (1 moderate, 5 high, 1 critical)
  run 'npm audit fix' to fix them, or 'npm audit' for details

I run the npm audit fix (doesn’t actually fix any of the issues and suggests to use --force but this is normal for npm packages they have vulnerabilities, so sure this is not critical)

I then go to lift my node project again and get the same error:

Error: A dynamic link library (DLL) initialization routine failed. \\?\C:\wamp64\www\test\node_modules\@tensorflow\tfjs-node\lib\napi-v4\tfjs_binding.node at

I have checked in the following folder: d:\development\node_modules@tensorflow\tfjs-node-gpu\lib

and it contains two files under ‘napi-v4’; tensorflow.symlink tfjs_binding.node

It would be great to get this working, thanks for any suggestions.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 25 (7 by maintainers)

Most upvoted comments

@mrpetef10 Let’s try package @tensorflow/tfjs-node, so the configurations of GPU will not influence the debug process.

  1. can you confirm what is inside C:\wamp64\www\test\node_modules\@tensorflow\tfjs-node\deps
  2. does it work if you manualy copy items in C:\wamp64\www\test\node_modules\@tensorflow\tfjs-node\deps\lib to C:\wamp64\www\test\node_modules\@tensorflow\tfjs-node\lib