greenheartgames / greenworks

a node.js plugin to integrate nw.js/electron games with steamworks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"greenworks-win64.node module not found" when the file is present in the directory

sameer-manek opened this issue · comments

my current project tree :
│ .gitignore
│ index.html
│ LICENSE.md
│ main.js
│ package-lock.json
│ package.json
│ preload.js
│ README.md
│ renderer.js
│ renderer.original.js
│ steam_appid.txt

├───.github
│ dependabot.yml

└───greenworks
│ greenworks.js

└───lib
greenworks-win32.node
greenworks-win64.node
sdkencryptedappticket.dll
sdkencryptedappticket.lib
sdkencryptedappticket64.dll
sdkencryptedappticket64.lib
steam_api.dll
steam_api.lib
steam_api64.dll
steam_api64.lib

I am using prebuilt release binaries (v 0.14.0), steam sdk v 1.42. I have checked threads -

yet failed to get the application running.

Please help me with where I got it wrong.

ERROR:
App threw an error during load
Error: The specified module could not be found.
\?\C:\Users\sameer\Dev\work\upwork\OliverL\fi2\greenworks\lib\greenworks-win64.node
at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1812)
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. (C:\Users\sameer\Dev\work\upwork\OliverL\fi2\greenworks\greenworks.js:17:18)
at Module._compile (internal/modules/cjs/loader.js:1152:30)

I also tried the same with nw js and got a similar error

You check nw.js version

@henggedaren I did, and had the same issue.

@hokein
I have set up greenworks with the prebuilt binaries for NW.js 0.33.3 and steamworks SDK 1.42, followed these instructions, it works fine on linux but on windows, with a similar setup, i get

`Uncaught Error: The specified procedure could not be found.
\?\C:\Users\ittehgav\Desktop\game\dist\game-1.0.0-win-x64\lib\greenworks-win64.node

at Object.Module._extensions..node (node:internal/modules/cjs/loader:1206:18)

at Module.load (node:internal/modules/cjs/loader:991:32)

at Function.Module._load (node:internal/modules/cjs/loader:831:14)

at Module.require (node:internal/modules/cjs/loader:1015:19)

at require (node:internal/modules/cjs/helpers:92:18)

at Object.<anonymous> (C:\Users\ittehgav\Desktop\game\dist\game-1.0.0-win-x64\greenworks.js:17:18)

at Module._compile (node:internal/modules/cjs/loader:1126:14)

at Object.Module._extensions..js (node:internal/modules/cjs/loader:1161:10)

at Module.load (node:internal/modules/cjs/loader:991:32)

at Function.Module._load (node:internal/modules/cjs/loader:831:14)`

@hokein
I have set up greenworks with the prebuilt binaries for NW.js 0.33.3 and steamworks SDK 1.42, followed these instructions, it works fine on linux but on windows, with a similar setup, i get

`Uncaught Error: The specified procedure could not be found.
?\C:\Users\ittehgav\Desktop\game\dist\game-1.0.0-win-x64\lib\greenworks-win64.node

at Object.Module._extensions..node (node:internal/modules/cjs/loader:1206:18)

at Module.load (node:internal/modules/cjs/loader:991:32)

at Function.Module._load (node:internal/modules/cjs/loader:831:14)

at Module.require (node:internal/modules/cjs/loader:1015:19)

at require (node:internal/modules/cjs/helpers:92:18)

at Object.<anonymous> (C:\Users\ittehgav\Desktop\game\dist\game-1.0.0-win-x64\greenworks.js:17:18)

at Module._compile (node:internal/modules/cjs/loader:1126:14)

at Object.Module._extensions..js (node:internal/modules/cjs/loader:1161:10)

at Module.load (node:internal/modules/cjs/loader:991:32)

at Function.Module._load (node:internal/modules/cjs/loader:831:14)`

@hokein
我已经用NW.js 0.33.3和steamworks SDK 1.42的预编译二进制文件设置了greenworks,按照这些说明,它在linux上工作正常,但在Windows上,使用类似的设置,我得到了

`未捕获的错误:找不到指定的过程。
\?\ C:\ Users \ ittehgav \ Desktop \ game \ dist \ game-1.0.0-win-x64 \ lib \ greenworks-win64.node

at Object.Module._extensions..node (node:internal/modules/cjs/loader:1206:18)

at Module.load (node:internal/modules/cjs/loader:991:32)

at Function.Module._load (node:internal/modules/cjs/loader:831:14)

at Module.require (node:internal/modules/cjs/loader:1015:19)

at require (node:internal/modules/cjs/helpers:92:18)

at Object.<anonymous> (C:\Users\ittehgav\Desktop\game\dist\game-1.0.0-win-x64\greenworks.js:17:18)

at Module._compile (node:internal/modules/cjs/loader:1126:14)

at Object.Module._extensions..js (node:internal/modules/cjs/loader:1161:10)

at Module.load (node:internal/modules/cjs/loader:991:32)

at Function.Module._load (node:internal/modules/cjs/loader:831:14)`

Sorry, I have the same problem in window

QQ截图20210126131913

Having this same issue, myself. @sameer-manek @ittehgav did you end up figuring out a workaround?

Same issue here too. Mac worked. Windows not.

I copied all kinds of .dll, .dylib and .node files into the node_modules/greenworks/lib directory.

I didn't know that it was necessary to use the electron-rebuild. On Mac it somewhat worked without and I thought it was for the final build (I am using electron-builder for that).

It's all in here:
https://github.com/greenheartgames/greenworks/blob/master/docs/build-instructions-electron.md

Any update on this? I cant get past the The specified module could not be found. error when it tries to find the .node file.

Could it be due to greenworks targeting electron v3 whereas electron is now on v13?

Sometimes this is an issue with mismatched sdk, node versions, electron / os versions. I suggest using the prebuilt binaries and verifying that all the versions are aligned. If you try again, document all the versions of SDK, node, electron used and a link to the prebuilt binary being used.

Here are the latest prebuilts:

https://greenworks-prebuilds.armaldio.xyz/

I did a quick test, the last working version of Electron that works for me with the prebuilt is https://www.electronjs.org/releases/stable?version=12 (12.2.3).

To make this work I had to change main.js (see comments with ***). These are potentially security holes, so use/review with caution.

function createWindow () {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      // *** Add next two lines ***
      nodeIntegration: true,
      contextIsolation: false,
      preload: path.join(__dirname, 'preload.js')
    }
  })

  // and load the index.html of the app.
  mainWindow.loadFile('index.html')

  // Open the DevTools.
  // mainWindow.webContents.openDevTools()
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.

// *** Add next line ***
app.allowRendererProcessReuse = false
app.whenReady().then(() => {
  createWindow()

  app.on('activate', function () {
    // On macOS it's common to re-create a window in the app when the
    // dock icon is clicked and there are no other windows open.
    if (BrowserWindow.getAllWindows().length === 0) createWindow()
  })
})

It looks like for Electron versions after this, the GreenWorks binary interface source files need to be changed to be NAPI/context-aware, see this issue:

electron/electron#18397

I used Electron 12.2.3, Steam SDK 1.50 and this prebuilt:
https://greenworks-prebuilds.armaldio.xyz/?os=win32&arch=x64&runtime=electron&version=v87&tag=v0.6.0%20-%20Steamworks%20v1.5.0

I think I'll just leave greenworks/steamworks out of my project. With the latest release being over 3 years ago and none of the newer versions of things like electron supported, it's not really viable to use in new projects

I think I'll just leave greenworks/steamworks out of my project. With the latest release being over 3 years ago and none of the newer versions of things like electron supported, it's not really viable to use in new projects

greenworks do works great yet, I'm using it on electron 16 (almost) without problems, check my fork if you want some important updates

@ceifa What version of the steamworks sdk do you use with your fork? 1.41? 1.50?

@ceifa Great work in that fork! I'm going to build locally and try Electron 16 again. I also let the prebuild site owner know about the fork.

I tried that fork with 1.42 of the sdk and the .node file from the v0.14 release (i couldnt find that file in your repo) and i still get the issue with it not finding the .node file as a module

@connorsleight you will need to use his repo to build a new node file with the version of electron you want to use.

I successfully built the node files on windows and ran the electron quick start with Electron 16.0.5 and Steam 1.50 SDK. The test app successfully connected to Steam.

I used the 'Building with electron-rebuild' method to build the node files and run the test app. Note that instead of doing npm install --save --ignore-scripts git+https://github.com/greenheartgames/greenworks.git, I did npm install --save --ignore-scripts git+https://github.com/ceifa/greenworks.git to get the fork.

I had to do one change to the test app in main.js before doing npm start to test the app:

function createWindow () {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      // *** Add next two lines to get require() to work
      nodeIntegration: true,
      contextIsolation: false,
      preload: path.join(__dirname, 'preload.js')
    }
  })

@ceifa thanks for the updated fork!

@ceifa What version of the steamworks sdk do you use with your fork? 1.41? 1.50?

The latest, 1.53a

@ceifa @MikalDev - Thanks for the fork & help on this! Is there a way to generate the *.node files for systems I don't have? Using electron-rebuild works for the current system, but if I wanted to generate for Mac + Windows + Linux, is there a way to do that?

@ceifa @MikalDev - Thanks for the fork & help on this! Is there a way to generate the *.node files for systems I don't have? Using electron-rebuild works for the current system, but if I wanted to generate for Mac + Windows + Linux, is there a way to do that?

Idk if cross-building is possible, but today I build for the three using a github action, where I can specify the OS to be used.

https://docs.github.com/pt/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources

If you are on windows you can use the WSL2 to build for linux.

Two days ago I spent a good 8 hours on trying to get greenworks to work with the newest version of things.

By chance I saw @ceifa's steamworks.js: https://github.com/ceifa/steamworks.js and gave it a try. 5 minutes later I properly booted up my Electron game with access to the Steamworks SDK-features & Steam overlay.

You are a champ @ceifa !