question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when installing(?) and crash upon importing

See original GitHub issue

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: Electron app
  • TensorFlow.js installed from (npm or script link): npm
  • TensorFlow.js version: @tensorflow/tfjs-node@3.0.0
  • CUDA/cuDNN version: None

Describe the problem While installing tfjs-node, I get an weird message, which I’m not sure is an error. When importing thee library I get a crashing error, as seen below.

Provide the exact sequence of commands / steps that you executed before running into the problem Installing:

PS C:\Users\lfernandes\folder_sorter\my-electron-app> npm install @tensorflow/tfjs-node --build-from-source      

> @tensorflow/tfjs-node@3.0.0 install C:\Users\lfernandes\folder_sorter\my-electron-app\node_modules\@tensorflow\tfjs-node
> node scripts/install.js

CPU-windows-3.0.0.zip
* Downloading libtensorflow
[==============================] 6079896/bps 100% 0.0s
* Building TensorFlow Node.js bindings
symlink ./lib/napi-v7 failed:  null
npm WARN my-electron-app@1.0.0 No description
npm WARN my-electron-app@1.0.0 No repository field.

+ @tensorflow/tfjs-node@3.0.0
added 107 packages from 65 contributors and audited 200 packages in 27.77s

11 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

I find the line symlink ./lib/napi-v7 failed: null really weird. Maybe the root of the error below is here, however I could not find any info regarding this message.

Importing:

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

Any other info / logs

importing error:

Uncaught Error: The Node.js native addon module (tfjs_binding.node) can not be found at path: C:\Users\lfernandes\folder_sorter\my-electron-app\node_modules\@tensorflow\tfjs-node\lib\napi-v6\tfjs_binding.node. 
Please run command 'npm rebuild @tensorflow/tfjs-node build-addon-from-source' to rebuild the native addon module. 
If you have problem with building the addon module, please check https://github.com/tensorflow/tfjs/blob/master/tfjs-node/WINDOWS_TROUBLESHOOTING.md or file an issue.
    at Object.<anonymous> (C:\Users\lfernandes\folder_sorter\my-electron-app\node_modules\@tensorflow\tfjs-node\dist\index.js:49:11)
    at Object.<anonymous> (C:\Users\lfernandes\folder_sorter\my-electron-app\node_modules\@tensorflow\tfjs-node\dist\index.js:81:3)
    at Module._compile (internal/modules/cjs/loader.js:1152:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1173:10)
    at Module.load (internal/modules/cjs/loader.js:992:32)
    at Module._load (internal/modules/cjs/loader.js:885:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12738)
    at Module.require (internal/modules/cjs/loader.js:1032:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\lfernandes\folder_sorter\my-electron-app\renderer.js:3:12)

In case I try the fix suggested in the error message, I still get the same weird message symlink ./lib/napi-v7 failed: null while the importing error persists:

PS C:\Users\lfernandes\folder_sorter\my-electron-app> npm rebuild @tensorflow/tfjs-node --build-addon-from-source

> @tensorflow/tfjs-node@3.0.0 install C:\Users\lfernandes\folder_sorter\my-electron-app\node_modules\@tensorflow\tfjs-node
> node scripts/install.js

CPU-windows-3.0.0.zip
* Building TensorFlow Node.js bindings
symlink ./lib/napi-v7 failed:  null

I am new to javascript and node, so please tell me if you need any other info.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
LPugenscommented, Feb 4, 2021

Thanks! I managed to make it work with he info in the issue you linked.

After some research, I found out that the node version used to install the node packages (such as tfjs) should be the exact one bundled with electron. Mainly because of the napi version. As seen on the release blog post, the current electron version (11.0.0) has to be paired with node version 12.18.3. After this simple fix, and reinstalling the packages, the app is working fine. I just wish it was better documented for newcomers in the electron project.

Thanks again @rthadur!

0reactions
Diabl0269commented, Feb 28, 2021

@Diabl0269 The deps folder of the package is located at .\node_modules\@tensorflow\tfjs-node\deps for local installations.

Thanks.

In my case I haven’t been able to install the package so I guess this a different issue, which I already asked about in a new thread. https://github.com/tensorflow/tfjs/issues/4761

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip3 Crashing with Import Error - python - Stack Overflow
Try sudo apt install --reinstall python3-pkg-resources python3-setuptools . Although pkg_resources is normally included in setuptools ...
Read more >
FCPX crash on file import - Apple Community
I installed some free audio plugins, after which FCPX started to crash when trying to import material. Doesn't matter; drag and drop, ...
Read more >
Importing metahuman crashes editor - Unreal Engine Forums
Hello, whenever I try to import a metahuman from Bridge the editor crashes and I get the following error message: Assertion failed: Pair...
Read more >
FAQ: Why does Python crash when importing arcpy from the ...
One possible solution to resolve the Python crash is to go into the System32 folder and then rename the libcrypto-1_1-x64.dll file. This is...
Read more >
How to fix Premiere Pro crash issues - Adobe Support
On Windows? Check your Windows 10 build number and make sure your system is updated to build number 1903. Suggested troubleshooting ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found