greenworks icon indicating copy to clipboard operation
greenworks copied to clipboard

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

Open sameer-manek opened this issue 4 years ago • 20 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 -

  • https://github.com/greenheartgames/greenworks/issues/152
  • https://github.com/greenheartgames/greenworks/issues/159

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)

sameer-manek avatar Jan 18 '21 07:01 sameer-manek

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

sameer-manek avatar Jan 18 '21 11:01 sameer-manek

You check nw.js version

henggedaren avatar Jan 20 '21 13:01 henggedaren

@henggedaren I did, and had the same issue.

sameer-manek avatar Jan 21 '21 06:01 sameer-manek

@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)`

ittehgav avatar Jan 25 '21 23:01 ittehgav

@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

henggedaren avatar Jan 26 '21 05:01 henggedaren

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

michaelpelletier avatar May 23 '21 15:05 michaelpelletier

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

francois-dibulo avatar Sep 03 '21 12:09 francois-dibulo

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?

connorsleight avatar Dec 30 '21 21:12 connorsleight

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/

MikalDev avatar Dec 31 '21 06:12 MikalDev

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:

https://github.com/electron/electron/issues/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

MikalDev avatar Dec 31 '21 08:12 MikalDev

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

connorsleight avatar Dec 31 '21 12:12 connorsleight

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 avatar Dec 31 '21 13:12 ceifa

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

connorsleight avatar Dec 31 '21 23:12 connorsleight

@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.

MikalDev avatar Jan 01 '22 04:01 MikalDev

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 avatar Jan 01 '22 04:01 connorsleight

@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!

MikalDev avatar Jan 01 '22 04:01 MikalDev

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

The latest, 1.53a

ceifa avatar Jan 01 '22 18:01 ceifa

@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?

michaelpelletier avatar Jan 02 '22 16:01 michaelpelletier

@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.

ceifa avatar Jan 02 '22 17:01 ceifa

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 !

kkortes avatar May 05 '22 10:05 kkortes