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

Electron example not running in windows machine #6529

Closed
NitinKhandelwal1947 opened this issue Nov 12, 2019 · 20 comments · Fixed by #6850
Closed

Electron example not running in windows machine #6529

NitinKhandelwal1947 opened this issue Nov 12, 2019 · 20 comments · Fixed by #6850
Labels
electron issues related to the electron target OS/Windows issues related to the Windows OS 🤔 needs more info issues that require more info from the author

Comments

@NitinKhandelwal1947
Copy link

Description

Electron example not running in windows machine

Reproduction Steps

yarn && yarn rebuild:electron && cd examples/electron && yarn start
Electron window does not pops up.
Also observed sometimes failing with native dependency find-git-repositories
Error: The specified procedure could not be found findGitRepos.node

$ yarn rebuild:electron
yarn run v1.7.0
$ theia rebuild:electron
Processing @theia/node-pty
Processing nsfw
Processing native-keymap
Processing find-git-repositories
Done in 7.96s.
$ cd examples/electron/
$ yarn start
yarn run v1.7.0
$ theia start --plugins=local-dir:../../plugins
Done in 2.74s.

OS and Theia version:
Windows 10
yarn version:- 1.7.0
node version:- 10.15.3
npm version:- 4.2.0

Diagnostics:

@akosyakov akosyakov added 🤔 needs more info issues that require more info from the author electron issues related to the electron target OS/Windows issues related to the Windows OS labels Nov 12, 2019
@akosyakov
Copy link
Member

@eclipse-theia/eclipse-theia Could someone with Windows machine double check?

@kittaakos
Copy link
Contributor

Also observed sometimes failing with native dependency find-git-repositories

@NitinKhandelwal1947, do you have a stack trace? What is your electron-builder version? Does this thread help?

@tsmaeder
Copy link
Contributor

Here you go:

C:\Users\thomas\code\theia\examples\electron>yarn start
yarn run v1.19.1
$ theia start --plugins=local-dir:../../plugins

 Failed to start the backend application.
Error: The specified procedure could not be found.
\\?\C:\Users\thomas\code\theia\node_modules\find-git-repositories\build\Release\findGitRepos.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:722:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
    at Module.load (internal/modules/cjs/loader.js:602:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
    at Function.Module._load (internal/modules/cjs/loader.js:533:3)
    at Module.require (internal/modules/cjs/loader.js:640:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\Users\thomas\code\theia\node_modules\find-git-repositories\dist\index.js:3:16)
    at Object.<anonymous> (C:\Users\thomas\code\theia\node_modules\find-git-repositories\dist\index.js:46:3)
Error: The specified procedure could not be found.
\\?\C:\Users\thomas\code\theia\node_modules\find-git-repositories\build\Release\findGitRepos.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:722:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
    at Module.load (internal/modules/cjs/loader.js:602:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
    at Function.Module._load (internal/modules/cjs/loader.js:533:3)
    at Module.require (internal/modules/cjs/loader.js:640:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\Users\thomas\code\theia\node_modules\find-git-repositories\dist\index.js:3:16)
    at Object.<anonymous> (C:\Users\thomas\code\theia\node_modules\find-git-repositories\dist\index.js:46:3)
Done in 3.08s.

@NitinKhandelwal1947
Copy link
Author

Also observed sometimes failing with native dependency find-git-repositories

@NitinKhandelwal1947, do you have a stack trace? What is your electron-builder version? Does this thread help?

\\?\C:\theia\examples\electron\dist\win-ia32-unpacked\resources\app\node_modules\find-git-repositories\build\Release\findGitRepos.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:722:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
    at Module.load (internal/modules/cjs/loader.js:602:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
    at Function.Module._load (internal/modules/cjs/loader.js:533:3)
    at Module.require (internal/modules/cjs/loader.js:640:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\theia\examples\electron\dist\win-ia32-unpacked\resources\app\node_modules\find-git-repositories\dist\index.js:3:16)
    at Object.<anonymous> (C:\theia\examples\electron\dist\win-ia32-unpacked\resources\app\node_modules\find-git-repositories\dist\index.js:46:3)```

I was using electron-builder 20.44.4 , but as mentioned in other 
link electron-builder@21.2.0 did not solve my problem

@kittaakos
Copy link
Contributor

Here you go:

C:\Users\thomas\code\theia\examples\electron>yarn start
yarn run v1.19.1
$ theia start --plugins=local-dir:../../plugins

 Failed to start the backend application.
Error: The specified procedure could not be found.
\\?\C:\Users\thomas\code\theia\node_modules\fi

@tsmaeder, thanks but I have no idea what you did and I do not understand how the Theia electron example relates to the electron-builder.

I was using electron-builder 20.44.4 , but as mentioned in other
link electron-builder@21.2.0 did not solve my problem

@NitinKhandelwal1947, any chance you can share your package.json? It is hard to see what you are doing. If you want to build the electron example inside the eclipse-theia/theia, it won't work.

@kittaakos
Copy link
Contributor

but as mentioned in other
link

Where?

@paul-marechal
Copy link
Member

paul-marechal commented Nov 12, 2019

According to Electron documentation, this issue comes from the way the find-git-repositories package builds its native bits. See https://electronjs.org/docs/tutorial/using-native-node-modules#a-note-about-win_delay_load_hook.

They have a commit that enables the win_delay_load_hook flag, but I don't think we pull this version, hence this issue.

I was able to get past that error on my Windows machine by editing this flag to true in my node_modules before running yarn rebuild:electron and it worked.

@paul-marechal
Copy link
Member

paul-marechal commented Nov 12, 2019

I think the following patch fixes that issue: #6255

Edit: It partially fixes the issue, another one appears when using the linked PR.

@paul-marechal paul-marechal mentioned this issue Nov 12, 2019
1 task
@tsmaeder
Copy link
Contributor

@tsmaeder, thanks but I have no idea what you did and I do not understand how the Theia electron example relates to the electron-builder.

It's the output of doing "yarn start" in the electron example folder. Building works fine, running does not.

@NitinKhandelwal1947
Copy link
Author

Here you go:

C:\Users\thomas\code\theia\examples\electron>yarn start
yarn run v1.19.1
$ theia start --plugins=local-dir:../../plugins

 Failed to start the backend application.
Error: The specified procedure could not be found.
\\?\C:\Users\thomas\code\theia\node_modules\fi

@tsmaeder, thanks but I have no idea what you did and I do not understand how the Theia electron example relates to the electron-builder.

I was using electron-builder 20.44.4 , but as mentioned in other
link electron-builder@21.2.0 did not solve my problem

@NitinKhandelwal1947, any chance you can share your package.json? It is hard to see what you are doing. If you want to build the electron example inside the eclipse-theia/theia, it won't work.

i am trying to build and package theia as electron app for Mac and Windows machine. Basically trying to make dmg and .exe . I took eclipse-theia/theia code base and trying to package it using electron-builder.

package.json:-

{
  "private": true,
  "name": "lite",
  "version": "0.11.0",
  "license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0",
  "author": "abc",
  "theia": {
    "target": "electron",
    "frontend": {
      "config": {
        "applicationName": "Theia Electron Example"
      }
    },
    "backend": {
      "config": {
        "startupTimeout": -1
      }
    }
  },
  "main": "./src-gen/frontend/electron-main.js",
  "dependencies": {
    "@theia/callhierarchy": "^0.11.0",
    "@theia/console": "^0.11.0",
    "@theia/core": "^0.11.0",
    "@theia/debug": "^0.11.0",
    "@theia/editor": "^0.11.0",
    "@theia/editor-preview": "^0.11.0",
    "@theia/editorconfig": "^0.11.0",
    "@theia/file-search": "^0.11.0",
    "@theia/filesystem": "^0.11.0",
    "@theia/getting-started": "^0.11.0",
    "@theia/git": "^0.11.0",
    "@theia/java": "^0.11.0",
    "@theia/java-debug": "^0.11.0",
    "@theia/json": "^0.11.0",
    "@theia/keymaps": "^0.11.0",
    "@theia/languages": "^0.11.0",
    "@theia/markers": "^0.11.0",
    "@theia/merge-conflicts": "^0.11.0",
    "@theia/messages": "^0.11.0",
    "@theia/metrics": "^0.11.0",
    "@theia/mini-browser": "^0.11.0",
    "@theia/monaco": "^0.11.0",
    "@theia/navigator": "^0.11.0",
    "@theia/outline-view": "^0.11.0",
    "@theia/output": "^0.11.0",
    "@theia/plugin-dev": "^0.11.0",
    "@theia/preferences": "^0.11.0",
    "@theia/preview": "^0.11.0",
    "@theia/process": "^0.11.0",
    "@theia/python": "^0.11.0",
    "@theia/search-in-workspace": "^0.11.0",
    "@theia/task": "^0.11.0",
    "@theia/terminal": "^0.11.0",
    "@theia/textmate-grammars": "^0.11.0",
    "@theia/tslint": "^0.11.0",
    "@theia/typehierarchy": "^0.11.0",
    "@theia/typescript": "^0.11.0",
    "@theia/userstorage": "^0.11.0",
    "@theia/variable-resolver": "^0.11.0",
    "@theia/workspace": "^0.11.0",
    "electron-store": "^5.0.0",
    "fix-path": "2.1.0",
    "native-keymap": "^2.0.0",
    "oniguruma": "^7.2.0"
  },
  "scripts": {
    "start": "theia start --plugins=local-dir:../../plugins",
    "prepare": "yarn run build",
    "build": "theia build",
    "package": "electron-builder",
    "package:preview": "electron-builder --dir",
    "package:all": "electron-builder -mw"
  },
  "devDependencies": {
    "@theia/cli": "^0.11.0",
    "electron": "^4.0.2",
    "electron-builder": "20.44.4"
  }
}

packaging is happening in windows machine but when try to execute or run the .exe its failing with native dependency like find-git-repositories.

@NitinKhandelwal1947
Copy link
Author

but as mentioned in other
link

Where?

Axosoft/find-git-repositories#5

@akosyakov
Copy link
Member

akosyakov commented Nov 13, 2019

I thought that it is not possible to bundle from yarn workspaces? See #4874 Correct me if i'm wrong @kittaakos

You could setup the standalone package as here: https://github.com/theia-ide/theia-apps/tree/master/theia-electron

@tsmaeder
Copy link
Contributor

@kittaakos @akosyakov I can confirm that building and running the electron example does not work for me on Windows 10 (this is what the issue title and description describe). I do a git clone, yarn , yarn rebuild:electron and then yarn run start from the electron example. I provided a stack trace of my failure.

@akosyakov
Copy link
Member

@tsmaeder understood, just wanted to point out that bundling from sources won't work anyway since @NitinKhandelwal1947 is trying it

@akosyakov
Copy link
Member

@tsmaeder btw could you try again since #6255 was merged and according to #6529 (comment) it could help

@tsmaeder
Copy link
Contributor

I pulled this morning, so should have the contents of the merged PR and removed everything from node_modules and examples/electron node-modules. That should cover the case, right @akosyakov ?
I had a bit of trouble setting up the build enviroment on windows, so I'm ready to believe it's my setup. Not sure how to check, though.

@sorekz
Copy link

sorekz commented Nov 13, 2019

This might be related to nodejs/node-gyp#1933
which will be fixed with the next electron-rebuild release

@paul-marechal
Copy link
Member

@sorekz this is precisely the error I see from this PR: #6538 (comment)

@Yashraj890
Copy link

Hello Team

I found one solution for this issue, just run the below command

npm install sqlite3 --build-from-source --runtime-electron --target-|YOUR ELECTRON VERSION| --dist-url=https://atom.io/download/electron

After running the above command, please run the - npm rebuild

Please let me know if anyone is able to resolve the issue with my solution.

Thanks

@NitinKhandelwal1947
Copy link
Author

According to Electron documentation, this issue comes from the way the find-git-repositories package builds its native bits. See https://electronjs.org/docs/tutorial/using-native-node-modules#a-note-about-win_delay_load_hook.

They have a commit that enables the win_delay_load_hook flag, but I don't think we pull this version, hence this issue.

I was able to get past that error on my Windows machine by editing this flag to true in my node_modules before running yarn rebuild:electron and it worked.

Thanks @marechal-p it worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electron issues related to the electron target OS/Windows issues related to the Windows OS 🤔 needs more info issues that require more info from the author
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants