0

it gives me an error everytime i try to import it, if i have a file with any line that imports the library

const tf = require("@tensorflowjs/tfjs-node");

or

const tf = require("@tensorflowjs/tfjs");
require("@tensorflowjs/tfjs-node");

and try to run it, it always gives me the same error:

node:internal/modules/cjs/loader:1183
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: A dynamic link library (DLL) initialization routine failed.
\\?\(PROJECT DIRECTORY)\node_modules\@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> ((PROJECT DIRECTORY)\node_modules\@tensorflow\tfjs-node\dist\index.js:68:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}

versions:

  • node v16.6.1
  • @tensorflowjs/tfjs ^3.8.0
  • @tensorflowjs/tfjs-node ^3.8.0

help :(

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
lópbu
  • 1
  • 2
  • The error's pretty clear: `Error: A dynamic link library (DLL) initialization routine failed`, which means you have compiled code for tensorflow, and it's not working, and you almost _certainly_ updated Node without recompiling this dependency. So: delete your node_modules, clear your npm cache, and rerun `npm install` so that tensorflow (and anything else) can recompile against your _current_ OS/Node combination, instead of what it was targeting before. – Mike 'Pomax' Kamermans Aug 12 '21 at 01:23
  • @Mike'Pomax'Kamermans already tried all of that, still getting the same error. btw, tensorflowjs gets imported just fine, it only gives me an error when tensorflowjs-node is involved – lópbu Aug 12 '21 at 01:32
  • If you already tried things, [mention everything you already tried in your post](/help/how-to-ask). – Mike 'Pomax' Kamermans Aug 12 '21 at 04:33

0 Answers0