Error loading TensorflowJS in Electron App (Nodejs)

情到浓时终转凉″ 提交于 2021-02-11 17:25:20

问题


I am trying to get tensorflow working in my electron app using tensorflow js.

Here are the details of the various versions:

Nodejs: v14.4.0 @tensorflow/tfjs - 2.0.0 @tensorflow/tfjs-node - 2.0.0 electron - 1.8.8

When I try to load the tfjs module using:

const tf = require('@tensorflow/tfjs');

I get the following error:

I have looked everywhere but can't seem to find anything relevant for this error.

Any help would be much appreciated.


回答1:


SOLUTION

The issue seems to be one of competing libraries. Although I don't know exact which library, found a workaround which involved installing @tensorflow/tfjs first followed by all other libraries.

Thanks to @edkeveked for all his help.

The solution is to

  1. Create a new electron project
  2. Install electron followed by @tensorflow/tfjs
  3. Install all other required modules
  4. Move the node_modules directory from this to my original app directoy.

Hope this helps someone else facing this issue.



来源:https://stackoverflow.com/questions/62213645/error-loading-tensorflowjs-in-electron-app-nodejs

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