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

Cannot find module ''./build/Debug/buffertools.node' on windows electron #71

Closed
christianbirg opened this issue Oct 29, 2015 · 10 comments
Closed

Comments

@christianbirg
Copy link

I use pcsclite for scanning chip cards (buffertools is a node_module of them) in my electron app. on mac osx it works fine but when i start the same app on windows (win7) it raises an error

Uncaught Error: Cannot find module ''./build/Debug/buffertools.node'

The problem is that he cannot find ./build/Release/buffertools.node and he run the catch block. But the ./build/Release/buffertools.node is there.

Someone got an idea, is that an electron bug or from buffertools? Someon has an work around?

@bnoordhuis
Copy link
Owner

What happens when you require('./node_modules/buffertools/build/Release/buffertools.node')? I speculate you get an error complaining it's built for the wrong node version or the wrong architecture?

@christianbirg
Copy link
Author

He also runs in the catch block.

this is my structure

- app
  - node_modules
    - buffertools
    - electron-prebuilt
    - pcsclite
    - ...
  - index.html
  - main.js
  - package.json

that is my package json

{
  "name": "application",
  "version": "0.1.0",
  "main": "main.js",
  "dependencies": {
     "angular": "1.4.7",
     "angular-ui-router": "0.2.15",
     "babel": "5.8.29",
     "buffertools": "2.1.3",
     "electron-prebuilt": "0.34.0",
     "electron-reload": "0.2.0",
     "jquery": "2.1.4",
     "pcsclite": "0.4.4"
   }
}

on my development maschine (mac osx) it works perfectly only on fucking windows it appears this error

@bnoordhuis
Copy link
Owner

He also runs in the catch block.

I think you misunderstood my suggestion. I'm asking you to require the .node file directly. Try this from the command line and post the output:

$ node -p 'require("./node_modules/buffertools/build/Release/buffertools.node")'

@christianbirg
Copy link
Author

I can only run this script on my development maschine i think and thats the output

$ node -p 'require("./node_modules/buffertools/build/Release/buffertools.node")'


{ clear: [Function: clear],
 compare: [Function: compare],
 concat: [Function: concat],
 equals: [Function: equals],
 fill: [Function: fill],
 fromHex: [Function: fromHex],
 indexOf: [Function: indexOf],
 reverse: [Function: reverse],
toHex: [Function: toHex] }

I hope this is what you mean. But like i said, on my development maschine it works like expected. I dont know how i can run a node command without installing nodejs (there ist only a node runtime (ndoe.dll) in the folder.

@christianbirg
Copy link
Author

Update:
the try of resolving ./build/Realease/buffertools.node throws following exception

    Error: %1 is not a valid Win32 application.
    (…)

C:\Users\IEUser\Desktop\RocketLicence-win32-ia32\resources\app\node_modules\buffertools\build\Release\buffertools.node
    at Error (native)
    at Object.module.(anonymous function) (ATOM_SHELL_ASAR.js:137:20)
    at Object.module.(anonymous function) [as .node] (ATOM_SHELL_ASAR.js:137:20)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\IEUser\Desktop\RocketLicence-win32-ia32\resources\app\node_modules\buffertools\buffertools.js:24:20)
    at Module._compile (module.js:434:26)
    at Module._extensions..js (module.js:452:10)

@bnoordhuis
Copy link
Owner

Looks like you're trying to load a 64 bits buffertools.node into a 32 bits run-time. Run node-gyp rebuild on the target machine.

@christianbirg
Copy link
Author

i have compiled it on a windows 32bit system and it works as a stand alone version, but in combination with electron it doesnt work. Now it is not the problem of this module, but maybe you have a solution for this?

@bnoordhuis
Copy link
Owner

You probably need to tell node-gyp where to find the electron headers / sources:

$ node-gyp --nodedir <path> rebuild
# or
$ npm install --nodedir <path> buffertools

@christianbirg
Copy link
Author

Ah okay thanks now i understand. Thats not the problem of your library but the problem of pscslite, it only works with node < 4, so and the electron verison is 0.34.2. I have run following commands

npm config set disturl=https://atom.io/download/atom-shell
npm config set target=0.34.2
npm config set arch= ia32

npm install buffertools
npm install pcsclite

Now i automate this build :) Thank you very much

@bnoordhuis
Copy link
Owner

No problem, glad to hear it's working now. I'll go ahead and close the issue.

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