fyears / electron-python-example

Electron as GUI of Python Applications
MIT License
2.04k stars 232 forks source link

DIfferent Node.js version, DLL Initializing #9

Closed Chaoste closed 7 years ago

Chaoste commented 7 years ago

Hi fyears,

I'm following your tutorial after so many days of trying to get along with tkinter. In a way it feels weird to have two backends running seperatly (node and python), but in my case this is just what i need, because i build my framework, which I want to use, in python.

Unfortunately I'm facing an issue when running npm start. The window shows up, already showing the DOM like I want to look like, but the console opens up with the following error:

ELECTRON_ASAR.js:173
Uncaught Error: The module '\\?\C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\zerorpc\node_modules\zeromq\build\Release\zmq.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 50. This version of Node.js requires
NODE_MODULE_VERSION 53. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).

[...]

So I run npm rebuild and try it again. Now the console shows the following error:

Uncaught Error: Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
\\?\C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\zerorpc\node_modules\zeromq\build\Release\zmq.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\zerorpc\node_modules\zeromq\lib\index.js:6:11)
    at Object.<anonymous> (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\zerorpc\node_modules\zeromq\lib\index.js:839:3)

The german sentence of the uncaught error means "A DLL initialization routine failed" ;)

Thanks in advance, Thomas

LefterisJP commented 7 years ago

Hey @Chaoste. I had the exact same problem and using electron-rebuild as detailed in this SO answer solved the problem for me.

Chaoste commented 7 years ago

I already found this post, but I get an error, if I'm executing electron-rebuild. Can you help me out with this?

[After some gyp infos]
LINK : fatal error LNK1181: Eingabedatei "C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\zerorpc\node_modules\zeromq\build\Release\..\..\windows\lib\libzmq.lib" kann nicht geöffnet werden. [C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\zerorpc\node_modules\zeromq\build\zmq.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\node-gyp\lib\build.js:285:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Thomas\\Projekte\\merge-documents\\settings\\node_modules\\electron-rebuild\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.6.6" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source"
gyp ERR! cwd C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\zerorpc\node_modules\zeromq
gyp ERR! node -v v4.5.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok

Failed with exit code: 1
    at SafeSubscriber._error (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\lib\src\index.js:262:84)
    at SafeSubscriber.__tryOrUnsub (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:236:16)
    at SafeSubscriber.error (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:197:26)
    at Subscriber._error (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:128:26)
    at Subscriber.error (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:102:18)
    at MapSubscriber.Subscriber._error (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:128:26)
    at MapSubscriber.Subscriber.error (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:102:18)
    at SafeSubscriber._next (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\lib\src\index.js:236:65)
    at SafeSubscriber.__tryOrSetError (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:245:16)
    at SafeSubscriber.next (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:187:27)
    at Subscriber._next (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:125:26)
    at Subscriber.next (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:89:18)
    at ReduceSubscriber._complete (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\operator\reduce.js:119:30)
    at ReduceSubscriber.Subscriber.complete (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:114:18)
    at MergeAllSubscriber._complete (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\operator\mergeAll.js:94:30)
    at MergeAllSubscriber.Subscriber.complete (C:\Users\Thomas\Projekte\merge-documents\settings\node_modules\electron-rebuild\node_modules\spawn-rx\node_modules\rxjs\Subscriber.js:114:18)
draperjames commented 7 years ago

@Chaoste did you figure out how to fix this? I have the same problem.

When I run the following:

npm install --save-dev electron-rebuild
./node_modules/.bin/electron-rebuild

I get these error messages:

An unhandled error occurred inside electron-rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.1
gyp info using node@7.10.0 | linux | x64
gyp http GET https://atom.io/download/electron/v1.6.8/iojs-v1.6.8.tar.gz
gyp http 200 https://atom.io/download/electron/v1.6.8/iojs-v1.6.8.tar.gz
gyp http GET https://atom.io/download/electron/v1.6.8/SHASUMS256.txt
gyp http 200 https://atom.io/download/electron/v1.6.8/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/home/jad/Github/electron-python-example/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jad/Github/electron-python-example/node_modules/zeromq/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jad/Github/electron-python-example/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jad/.electron-gyp/.node-gyp/iojs-1.6.8/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/jad/.electron-gyp/.node-gyp/iojs-1.6.8',
gyp info spawn args   '-Dnode_gyp_dir=/home/jad/Github/electron-python-example/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/jad/Github/electron-python-example/node_modules/zeromq',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/jad/Github/electron-python-example/node_modules/zeromq/build'
  CXX(target) Release/obj.target/zmq/binding.o
  SOLINK_MODULE(target) Release/obj.target/zmq.node
g++: error: ./Release/../../zmq/lib/libzmq.a: No such file or directory
zmq.target.mk:123: recipe for target 'Release/obj.target/zmq.node' failed
make: Leaving directory '/home/jad/Github/electron-python-example/node_modules/zeromq/build'
make: *** [Release/obj.target/zmq.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/jad/Github/electron-python-example/node_modules/node-gyp/lib/build.js:285:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-78-generic
gyp ERR! command "/usr/local/bin/node" "/home/jad/Github/electron-python-example/node_modules/.bin/node-gyp" "rebuild" "--target=1.6.8" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source"
gyp ERR! cwd /home/jad/Github/electron-python-example/node_modules/zeromq
gyp ERR! node -v v7.10.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok 

Failed with exit code: 1

Error: gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.1
gyp info using node@7.10.0 | linux | x64
gyp http GET https://atom.io/download/electron/v1.6.8/iojs-v1.6.8.tar.gz
gyp http 200 https://atom.io/download/electron/v1.6.8/iojs-v1.6.8.tar.gz
gyp http GET https://atom.io/download/electron/v1.6.8/SHASUMS256.txt
gyp http 200 https://atom.io/download/electron/v1.6.8/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/home/jad/Github/electron-python-example/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jad/Github/electron-python-example/node_modules/zeromq/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jad/Github/electron-python-example/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jad/.electron-gyp/.node-gyp/iojs-1.6.8/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/jad/.electron-gyp/.node-gyp/iojs-1.6.8',
gyp info spawn args   '-Dnode_gyp_dir=/home/jad/Github/electron-python-example/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/jad/Github/electron-python-example/node_modules/zeromq',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/jad/Github/electron-python-example/node_modules/zeromq/build'
  CXX(target) Release/obj.target/zmq/binding.o
  SOLINK_MODULE(target) Release/obj.target/zmq.node
g++: error: ./Release/../../zmq/lib/libzmq.a: No such file or directory
zmq.target.mk:123: recipe for target 'Release/obj.target/zmq.node' failed
make: Leaving directory '/home/jad/Github/electron-python-example/node_modules/zeromq/build'
make: *** [Release/obj.target/zmq.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/jad/Github/electron-python-example/node_modules/node-gyp/lib/build.js:285:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-78-generic
gyp ERR! command "/usr/local/bin/node" "/home/jad/Github/electron-python-example/node_modules/.bin/node-gyp" "rebuild" "--target=1.6.8" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source"
gyp ERR! cwd /home/jad/Github/electron-python-example/node_modules/zeromq
gyp ERR! node -v v7.10.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok 

Failed with exit code: 1
    at SafeSubscriber._error (/home/jad/Github/electron-python-example/node_modules/spawn-rx/lib/src/index.js:262:84)
    at SafeSubscriber.__tryOrUnsub (/home/jad/Github/electron-python-example/node_modules/rxjs/Subscriber.js:238:16)
    at SafeSubscriber.error (/home/jad/Github/electron-python-example/node_modules/rxjs/Subscriber.js:197:26)
    at Subscriber._error (/home/jad/Github/electron-python-example/node_modules/rxjs/Subscriber.js:128:26)
    at Subscriber.error (/home/jad/Github/electron-python-example/node_modules/rxjs/Subscriber.js:102:18)
    at MapSubscriber.Subscriber._error (/home/jad/Github/electron-python-example/node_modules/rxjs/Subscriber.js:128:26)
    at MapSubscriber.Subscriber.error (/home/jad/Github/electron-python-example/node_modules/rxjs/Subscriber.js:102:18)
    at SafeSubscriber._next (/home/jad/Github/electron-python-example/node_modules/spawn-rx/lib/src/index.js:236:65)
    at SafeSubscriber.__tryOrSetError (/home/jad/Github/electron-python-example/node_modules/rxjs/Subscriber.js:247:16)
    at SafeSubscriber.next (/home/jad/Github/electron-python-example/node_modules/rxjs/Subscriber.js:187:27)
draperjames commented 7 years ago

I opened a stackoverflow question on the error above so who knows maybe someone will answer it.

uiktiomasfeliz commented 7 years ago

@draperjames i just answered my solution for the same error here

Chaoste commented 7 years ago

Thanks your command fixed my problem: npm rebuild zeromq --runtime=electron --target=1.6.2