Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while getting the cppmodule #1

Closed
SimoneAncona opened this issue Apr 6, 2023 · 7 comments
Closed

Error while getting the cppmodule #1

SimoneAncona opened this issue Apr 6, 2023 · 7 comments

Comments

@SimoneAncona
Copy link

After building and running the project i recive the following error:

Error: The specified module could not be found..
\\?\C:\Users\simon\Documents\...\node_modules\raster\build\Release\native.node
    at Module._extensions..node (node:internal/modules/cjs/loader:1243:18)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (C:\Users\simon\Documents\...\node_modules\raster\src\node_env.js:1:19)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12) {
  code: 'ERR_DLOPEN_FAILED'
}

I noticed that, in the file node_env.js, in the first line there is a require to a file that does not exists. ../build/Release/native is the relative path used to import a C++ module

@dustmop
Copy link
Owner

dustmop commented Apr 6, 2023

@SimoneAncona thanks for trying this out. SDL support is somewhat of a work-in-progress, so I appreciate the feedback. Could you let me know the steps you did before this, that is, the specific commands you executed to build and run the code? Also, this looks like Windows, could you let me know what shell / terminal program you're running these commands in?

@SimoneAncona
Copy link
Author

@SimoneAncona thanks for trying this out. SDL support is somewhat of a work-in-progress, so I appreciate the feedback. Could you let me know the steps you did before this, that is, the specific commands you executed to build and run the code? Also, this looks like Windows, could you let me know what shell / terminal program you're running these commands in?

First of all i downloaded the latest SDL2 (2.26.5) library from GitHub and unzipped the tar.gz file into C:\
Then I installed raster and passed the locate_sdl.js check
To build I used npm run build that build my TypeScript project
But when i run the project it crashes.
I use PowerShell as shell but I also tried with WSL Ubuntu bash

@dustmop
Copy link
Owner

dustmop commented Apr 6, 2023

Thank you, this is very helpful info. I'm able to reproduce this problem and will work on a fix, I hope to have one ready soon. Also it looks like SDL changed their download page and raster.js needs to update its docs.

@dustmop
Copy link
Owner

dustmop commented Apr 6, 2023

Could you please try out a workaround? From the SDL releases page download SDL2-2.26.5-win32-x64.zip (the first link), unzip it and place the file SDL2.dll in the same directory that you're running npm / node commands in.

This step shouldn't be necessary in the long-term, I would just like to have you try it out and see if it fixes this immediate error that you're reporting.

@SimoneAncona
Copy link
Author

Could you please try out a workaround? From the SDL releases page download SDL2-2.26.5-win32-x64.zip (the first link), unzip it and place the file SDL2.dll in the same directory that you're running npm / node commands in.

This step shouldn't be necessary in the long-term, I would just like to have you try it out and see if it fixes this immediate error that you're reporting.

I moved the SDL2.dll and it works

@dustmop
Copy link
Owner

dustmop commented Apr 7, 2023

Glad to hear it! I think I know the proper fix, I'll get it in soon and then close this issue.

@dustmop
Copy link
Owner

dustmop commented Apr 8, 2023

I published a new version of raster.js, it's version 0.7.9. It fixes this issue by using a postinstall hook to copy the SDL2.dll into the proper location in node_modules after the native addon gets built. If you uninstall raster and delete the SDL2.dll file you copied into your project folder, then installing this new version should work. Just make sure that the zip you've dowloaded from SDL's releases is the "devel" version. The full installation instructions have been updated: https://github.com/dustmop/rasterjs#nodejs

@dustmop dustmop closed this as completed Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants