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

Can't find binaries on windows + electron-forge #75

Open
vsobotka opened this issue Mar 22, 2023 · 23 comments
Open

Can't find binaries on windows + electron-forge #75

vsobotka opened this issue Mar 22, 2023 · 23 comments

Comments

@vsobotka
Copy link

I am trying to work on a steam integration for our game on a M2 Mac, but due to the overlay not working (#50) I decided to use the Parallels Desktop instead. But on Windows in Parallels I am getting this error:

App threw an error during load
Error: The specified module could not be found.
\\?\C:\Users\vsobotka\workspace\landia\desktop_app\.webpack\main\native_modules\dist\win64\steamworksjs.win32-x64-msvc.node
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1822)
    at Module._extensions..node (node:internal/modules/cjs/loader:1259:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:2:1822)
    at Module.load (node:internal/modules/cjs/loader:1044:32)
    at Module._load (node:internal/modules/cjs/loader:885:12)
    at f._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1068:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at ./node_modules/steamworks.js/dist/win64/steamworksjs.win32-x64-msvc.node (C:\Users\vsobotka\workspace\landia\desktop_app\.webpack\main\index.js:933:18)
    at __webpack_require__ (C:\Users\vsobotka\workspace\landia\desktop_app\.webpack\main\index.js:1200:42)

We are using electron forge to wrap our app, and this is the error thrown by either electron-forge start or by trying to execute the exe from electron-forge make. Is it not supposed to work, or am I missing something?

@ceifa
Copy link
Owner

ceifa commented Mar 22, 2023

Never used electron-forge, but as the error says, it is trying to get a file that don't exists. I think to solve you just have to move the files on your build script.

@ceifa ceifa changed the title ARM Support Can't find binaries on windows + electron-forge Mar 22, 2023
@vsobotka
Copy link
Author

The error is not very readable for me, not sure what it is trying to do under the hood. But before we added the steamworks.js to the project it was working. I also verified and all the files mentioned in the stack trace are on the expected locations.

@mcolotto
Copy link

mcolotto commented Apr 1, 2023

Hello, I am having the same issue on my released game, which does not use electron-forge - instead it uses electron-webpack and electron-builder. The vast majority of players don't seem to be affected by this bug, and I myself cannot reproduce, but I am getting a few reports. In the affected cases, the file is physically present in the location, and not packed in the .asar for the app.

I don't think this info is very helpful, but wanted to add a datapoint since I saw this while trying to debug the issue.

@mcolotto
Copy link

mcolotto commented Apr 5, 2023

Hey, I was able to debug what was going on. It turns out that if you are missing the file VCRUNTIME140.dll the native module will fail to load and give this cryptic error message. See: https://stackoverflow.com/questions/41253450/error-the-specified-module-could-not-be-found

The solution was to include the latest Visual C++ Redist on the game configuration in the Steamworks admin (installation -> redistributables) so that it automatically installs when the game installs.

If you are facing this error, installing the Visual C++ redistributable should solve the problem. Otherwise it is possible this can also be solved if the file is included with steamworks.js together with the library, but given we're publishing on Steam anyway this seems like a much cleaner way to do it, just needs to be documented somewhere.

@ceifa
Copy link
Owner

ceifa commented Apr 5, 2023

Hey, I was able to debug what was going on. It turns out that if you are missing the file VCRUNTIME140.dll the native module will fail to load and give this cryptic error message.

Where did you see that this file was missing?

If you are facing this error, installing the Visual C++ redistributable should solve the problem. Otherwise it is possible this can also be solved if the file is included with steamworks.js together with the library, but given we're publishing on Steam anyway this seems like a much cleaner way to do it, just needs to be documented somewhere.

Related #38

@mcolotto
Copy link

mcolotto commented Apr 5, 2023

Where did you see that this file was missing?

I didn't actually see that the file was missing. This was a combination of asking someone with the problem to help me debug, and using Dependency Walker (http://www.dependencywalker.com/) to figure out what were the DLLs that were needed by the .node file, Since I hadn't set up my game to automatically install the redist, I suspected that may have been the issue - and changing the setting and asking the player who was helping me debug to reinstall the game actually worked to fix this problem, so I'm fairly confident that was the cause.

Related #38

I'm not sure why this dependency is needed either, but until that issue is figured out it might be a good idea to add a note to the installation instructions on the README.md that it's needed.

@vsobotka
Copy link
Author

@mcolotto Awesome! Installing https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170 seems to fix the issue for me. I still have some issues with my setup, but the game starts without an error.

@IlTimido
Copy link

IlTimido commented Jul 4, 2023

I can't make it work.
I'm on windows 10.
I installed also the VCRUNTIME140.dll as suggested but when it starts it gives me an error like the one above.
If I launch it with "electron-forge start" all works perfectly but when I pack and I go to the out win32etc etc directory and launch the exe from there, it hangs.
If I remove references to steamworks.js, all works fine.
The erros is that it seems that it can't find steamworksjs.win32-x64-msvc.node at the specified path, but the file is there.
However how it is possible that I can't find any steam***.dll in the directories? It is normal?
I'm doing this test with the test steamapp id 480 but as I have said with "electron-forge start" all works fine.
Any help?

@IlTimido
Copy link

IlTimido commented Jul 4, 2023

Hi guys, I think I have solved the problem.
I can't tell if it's related to VCRUNTIME140.dll or not, all I can say is that installing the redist people wrote about didn't solved my issue.

I solved JUST COPYING THE FILES "steam_api64.dll" and "steam_api64.lib" in the same directory where "steamworksjs.win32-x64-msvc.node" stands that is "[PROJECTNAME]\resources\app.asar.unpacked\node_modules\steamworks.js\dist\win64"
I copied them from the "node_modules\steamworks.js\dist\win64"

I used this program to check what was the dependencies that was missing "https://github.com/lucasg/Dependencies" and it told me that it was "steam_api64.dll"

@flyinghail
Copy link

flyinghail commented Sep 14, 2023

Hi guys, I think I have solved the problem. I can't tell if it's related to VCRUNTIME140.dll or not, all I can say is that installing the redist people wrote about didn't solved my issue.

I solved JUST COPYING THE FILES "steam_api64.dll" and "steam_api64.lib" in the same directory where "steamworksjs.win32-x64-msvc.node" stands that is "[PROJECTNAME]\resources\app.asar.unpacked\node_modules\steamworks.js\dist\win64" I copied them from the "node_modules\steamworks.js\dist\win64"

I used this program to check what was the dependencies that was missing "lucasg/Dependencies" and it told me that it was "steam_api64.dll"

It does solve the problem. The problem now is how to make "steam_api64.dll" and "steam_api64.lib" copy automatically when electron forge make.

@IlTimido
Copy link

Hi guys, I think I have solved the problem. I can't tell if it's related to VCRUNTIME140.dll or not, all I can say is that installing the redist people wrote about didn't solved my issue.
I solved JUST COPYING THE FILES "steam_api64.dll" and "steam_api64.lib" in the same directory where "steamworksjs.win32-x64-msvc.node" stands that is "[PROJECTNAME]\resources\app.asar.unpacked\node_modules\steamworks.js\dist\win64" I copied them from the "node_modules\steamworks.js\dist\win64"
I used this program to check what was the dependencies that was missing "lucasg/Dependencies" and it told me that it was "steam_api64.dll"

It does solve the problem. The problem now is how to make "steam_api64.dll" and "steam_api64.lib" copy automatically when electron forge make.

You mean to make the installer with these files inside right?
I haven't foud a solution, luckily on Steam this is not needed because I can upload a zip that contains the build of the project and all works fine.

@flyinghail
Copy link

flyinghail commented Sep 15, 2023

You mean to make the installer with these files inside right? I haven't foud a solution, luckily on Steam this is not needed because I can upload a zip that contains the build of the project and all works fine.

Does it work for you to package steamworks.js with electron forge?

I packaged the program with the electron-forge package and ran it with steam. The whole window is black, I don't know how to fix it.

I try to run init() in the main process and get an error: Error: failed to init the steamworks API.

I try to run init() in the renderer process, the whole window is black. Then, I try to output to the log file before init() and nothing is logged. Tried alert() before init() and nothing happens.

@IlTimido
Copy link

You mean to make the installer with these files inside right? I haven't foud a solution, luckily on Steam this is not needed because I can upload a zip that contains the build of the project and all works fine.

Does it work for you to package steamworks.js with electron forge?

I packaged the program with the electron-forge package and ran it with steam. The whole window is black, I don't know how to fix it.

I try to run init() in the main process and get an error: Error: failed to init the steamworks API.

I try to run init() in the renderer process, the whole window is black. Then, I try to output to the log file before init() and nothing is logged. Tried alert() before init() and nothing happens.

Have you included in the package the steam_appid.txt with the id of your app (or 480 that is the steam app for test)?
I've found this precious tutorial on how to use steamworks.js
https://liana.one/integrate-electron-steam-api-steamworks

@flyinghail
Copy link

flyinghail commented Sep 15, 2023

Have you included in the package the steam_appid.txt with the id of your app (or 480 that is the steam app for test)? I've found this precious tutorial on how to use steamworks.js liana.one/integrate-electron-steam-api-steamworks

Thanks. From the article, it should be possible to run init() in the main process.
Looks like I can try to fix that first.

@Inateno
Copy link

Inateno commented Jan 2, 2024

Fresh project here as I was getting issues with electron-builder I tried electorn-forge.
The asar option "true" trigger this error.

@ceifa what do you use as you said "do not use electron-forge" please?

Aside the asar issue, electron-forge works better the electron-builder for me (less issues arounds steam-overlay mostly).

@ceifa
Copy link
Owner

ceifa commented Jan 14, 2024

@ceifa what do you use as you said "do not use electron-forge" please?

I was just saying that I never used before. I use electron builder, but for no particular reason.

@Inateno
Copy link

Inateno commented Jan 14, 2024

I was just saying that I never used before. I use electron builder, but for no particular reason.

Ok no problem I was wondering if you had any particular issue.
I was using electron-builder, but the team wanted to try electron-packager directly which was not "good enough" for me, and I was trying electron-forge when I saw you comment lol (btw so far so good, I think I prefer it over electron-builder).

@gen256
Copy link

gen256 commented Feb 19, 2024

my solution

forge.config.js

module.exports = {
   packagerConfig: {
     asar: {
       unpackDir: "node_modules/steamworks.js/dist/**/*"
     }
   },
   ...

@AuWiMo
Copy link
Contributor

AuWiMo commented Mar 3, 2024

my solution

forge.config.js

module.exports = {
   packagerConfig: {
     asar: {
       unpackDir: "node_modules/steamworks.js/dist/**/*"
     }
   },
   ...

This solution worked for me and is incredibly simple. I will make a pull request to add this to the readme as it seems lots of users are having this issue.

@officialrobert
Copy link

module.exports = {
   packagerConfig: {
     asar: {
       unpackDir: "node_modules/steamworks.js/dist/**/*"
     }
   },

this doesn't work with webpack + typescript template, any tips?

@AlexStormwood
Copy link

AlexStormwood commented May 29, 2024

@officialrobert This works for me in my Electron Forge Webpack + ReactJS project:

asar: {
      unpack: "*.{node,dll,so}"
    },

@AlexStormwood
Copy link

AlexStormwood commented May 29, 2024

Just adding to note, too, that this is almost definitely a developer environment issue now. I have a project that has been building & running and publishing to Steam with no problem for the last couple of weeks. I formatted my computer yesterday, reinstalled what I thought was everything, but must've missed something: the exact same repo that was building 2 days ago was no longer working, giving the exact same error that the OP is showing.

My project builds perfectly fine in GitHub Actions Ubuntu and Windows runners, so I know it was definitely something in the dev computer.

I installed Visual Studio Community and the Visual Studio Community Build Tools with all the packages/features that seemed relevant to app development, as well as the Steamworks SDK Redist in Steam, restarted my computer, and then things started working again.

@officialrobert
Copy link

@officialrobert This works for me in my Electron Forge Webpack + ReactJS project:

asar: {
      unpack: "*.{node,dll,so}"
    },

Hey @AlexStormwood Thank you so much!

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

10 participants