Cant find \node_modules\@tensorflow\tfjs-node\lib\napi-v4\tfjs_binding.node

我是研究僧i 提交于 2020-04-13 17:26:12

问题


I have tried to get the tensorflow.js library to work for days now.

I have installed on my computer

  • Python 2.7
  • Visual Studio 2019
  • Node 12.13.0

This is the steps I've done to produce the error:

  1. Create empty folder
  2. npm init inside the folder
  3. npm install --save @tensorflow/tfjs-node
  4. created a index.js file
  5. added 1 line : require('@tensorflow/tfjs-node')
  6. tried to run node index.js

got this error:

C:\Users\kim_1\Desktop\workplz>node index.js
internal/modules/cjs/loader.js:1003
  return process.dlopen(module, path.toNamespacedPath(filename));
             ^

Error: The specified module could not be found.
\\?\C:\Users\kim_1\Desktop\workplz\node_modules\@tensorflow\tfjs-node\lib\napi-v4\tfjs_binding.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1003:18)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\Users\kim_1\Desktop\workplz\node_modules\@tensorflow\tfjs- 
    node\dist\index.js:44:16)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)

my package.json

{
  "name": "workplz",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@tensorflow/tfjs-node": "^1.3.0"
  }
}

回答1:


It is related to the version of tfjs-node. Installing a specific version such as @tensorflow/tfjs-node@1.2.3 will fix the issue.

Uninstall the latest package

npm uninstall --save @tensorflow/tfjs-node

And install the version 1.2.3

npm install --save @tensorflow/tfjs-node@1.2.3



回答2:


Update to the case:

@tensorflow/tfjs-node@1.3.0 has issues with Node version 12.13.0 (source https://github.com/tensorflow/tfjs/issues/2341)

Had to use @tensorflow/tfjs-node@1.2.11 with Node version 10.16.3



来源:https://stackoverflow.com/questions/58621373/cant-find-node-modules-tensorflow-tfjs-node-lib-napi-v4-tfjs-binding-node

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!