abbr / deasync

Turns async function into sync via JavaScript wrapper of Node event loop
MIT License
972 stars 73 forks source link

deasync: Could not locate the bindings file #179

Open atlas340 opened 1 year ago

atlas340 commented 1 year ago

Description

I am trying to use the deasync package in my project, but I am getting the following error:

Error: Could not locate the bindings file. Tried: → .../node_modules/deasync/build/deasync.node → .../node_modules/deasync/build/Debug/deasync.node → .../node_modules/deasync/build/Release/deasync.node →.../node_modules/deasync/out/Debug/deasync.node →.../node_modules/deasync/Debug/deasync.node → .../node_modules/deasync/out/Release/deasync.node →.../node_modules/deasync/Release/deasync.node →.../node_modules/deasync/build/default/deasync.node → .../node_modules/deasync/compiled/20.5.0/linux/x64/deasync.node → .../node_modules/deasync/addon-build/release/install-root/deasync.node → .../node_modules/deasync/addon-build/debug/install-root/deasync.node →.../node_modules/deasync/addon-build/default/install-root/deasync.node →.../node_modules/deasync/lib/binding/node-v115-linux-x64/deasync.node

I am using Node.js v20.5.0. I have tried reinstalling the deasync package, but the error persists.

Steps to Reproduce

  1. Install the deasync package.
  2. Try to import the deasync module.
  3. Get the error.

Expected Behavior

The deasync module should be imported successfully and I should be able to use it in my code.

Actual Behavior

I get the error message "Could not locate the bindings file".

Possible Solutions

I hope this information is helpful. Thank you for your time.

aakash14goplani commented 1 year ago

I think deasync is compatible upto Node v18.

SheldonWBM commented 1 year ago

This issue also occurs in Node v20.6.1 but does not occur in v18.17.1 Node v20 will be Active-LTS on 2023-10-24

Opening the generated log file, we find that the error is related to #181 please run "yarn add node-gyp" into your top-level workspace.

atlas340 commented 1 year ago

That's good to know. It seems that Node v20.6.1 might need some attention before it becomes Active-LTS. Thanks for sharing that information!

tskarman commented 1 year ago

I just noticed that the auto-generated deasync.vcxproj file contains invalid local paths.

<AdditionalIncludeDirectories>C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\include\node;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\src;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\deps\openssl\config;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\deps\openssl\openssl\include;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\deps\uv\include;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\deps\zlib;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\deps\v8\include;C:\Users\someuser\Dev\Repos\company\ClientSource\apps\ eatingplanner\node_modules\node-addon-api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

The invalid part in:

;C:\Users\someuser\Dev\Repos\company\ClientSource\apps\ eatingplanner\node_modules\node-addon-api;

is the sequence \ eatingplanner. It should be \seatingplanner.

;C:\Users\someuser\Dev\Repos\company\ClientSource\apps\seatingplanner\node_modules\node-addon-api;

Meaning that some logic replaced \s with \.

I wouldn't be too surprised if this was due to some breaking change around regular expressions. Node v20 release notes mention some RegExp changes:

tskarman commented 1 year ago

I just noticed that the auto-generated deasync.vcxproj file contains invalid local paths.

<AdditionalIncludeDirectories>C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\include\node;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\src;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\deps\openssl\config;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\deps\openssl\openssl\include;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\deps\uv\include;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\deps\zlib;C:\Users\someuser\AppData\Local\node-gyp\Cache\20.8.1\deps\v8\include;C:\Users\someuser\Dev\Repos\company\ClientSource\apps\ eatingplanner\node_modules\node-addon-api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

The invalid part in:

;C:\Users\someuser\Dev\Repos\company\ClientSource\apps\ eatingplanner\node_modules\node-addon-api;

is the sequence \ eatingplanner. It should be \seatingplanner.

;C:\Users\someuser\Dev\Repos\company\ClientSource\apps\seatingplanner\node_modules\node-addon-api;

Meaning that some logic replaced \s with \.

I wouldn't be too surprised if this was due to some breaking change around regular expressions. Node v20 release notes mention some RegExp changes:

I just noticed this commit that addressed some white-space issues: https://github.com/abbr/deasync/commit/b12bcb73bc2f27c8aa2fe04eb05196b74a274df8

And then I tried downgrading from deasync@0.1.28 to deasync@0.1.26. And yes, after doing that downgrade, I could successfully install deasync even on Node v20.

tskarman commented 1 year ago

And looking at the original issue description, my problem likely was a different one. I would expect my problem to only occur when a folder name starts with s. Anyway. I'll mention some more keywords here for others to find. The original error mentioned a missing napi.h file.

dhffdh commented 11 months ago

Try cp node_modules/deasync/bin/darwin-arm64-node-20/deasync.node node_modules/deasync/build/deasync.node. It helped me

SheldonWBM commented 10 months ago

After bumping deasync to version 0.1.29, Node v20 seems to be fully supported.