deasync: Could not locate the bindings file
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
- Install the deasync package.
- Try to import the deasync module.
- 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
- The deasync package may not be compatible with Node.js v20.5.0.
- The deasync package may not have been installed correctly.
- There may be a problem with my Node.js installation.
I hope this information is helpful. Thank you for your time.
I think deasync is compatible upto Node v18.
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.
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!
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:
- https://nodejs.org/de/blog/announcements/v20-release-announce#v8-113
- https://chromestatus.com/feature/5144156542861312
I just noticed that the auto-generated
deasync.vcxprojfile 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
\swith\.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:
- https://nodejs.org/de/blog/announcements/v20-release-announce#v8-113
- https://chromestatus.com/feature/5144156542861312
I just noticed this commit that addressed some white-space issues: https://github.com/abbr/deasync/commit/b12bcb73bc2f27c8aa2fe04eb05196b74a274df8
And then I tried downgrading from [email protected] to [email protected].
And yes, after doing that downgrade, I could successfully install deasync even on Node v20.
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.
Try cp node_modules/deasync/bin/darwin-arm64-node-20/deasync.node node_modules/deasync/build/deasync.node.
It helped me
After bumping deasync to version 0.1.29, Node v20 seems to be fully supported.