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

problems to start source code on windows #13

Closed
damien122 opened this issue Feb 27, 2018 · 11 comments
Closed

problems to start source code on windows #13

damien122 opened this issue Feb 27, 2018 · 11 comments

Comments

@damien122
Copy link

damien122 commented Feb 27, 2018

Hi,
I try to run the code on windows but get some errors while execute the command npm install after git clone.
I got the following errores:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! codemirror-markdown-list-autoindent@1.0.1 postinstall: `patch -p1 -d ../codemirror < markdown-list-autoindent.patch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the codemirror-markdown-list-autoindent@1.0.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

My npm and node version are:
node v8.9.4
npm v5.4.2

and some verbose log:

14157 verbose stack Error: codemirror-markdown-list-autoindent@1.0.1 postinstall: `patch -p1 -d ../codemirror < markdown-list-autoindent.patch`
14157 verbose stack Exit status 1
14157 verbose stack     at EventEmitter.<anonymous> (C:\Users\XXX\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
14157 verbose stack     at emitTwo (events.js:126:13)
14157 verbose stack     at EventEmitter.emit (events.js:214:7)
14157 verbose stack     at ChildProcess.<anonymous> (C:\Users\XXX\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
14157 verbose stack     at emitTwo (events.js:126:13)
14157 verbose stack     at ChildProcess.emit (events.js:214:7)
14157 verbose stack     at maybeClose (internal/child_process.js:925:16)
14157 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14158 verbose pkgid codemirror-markdown-list-autoindent@1.0.1

Also in my Linux environment on windows (WSL) I can't start the code with following errors:

17463 verbose lifecycle zettlr@0.11.0~postinstall: unsafe-perm in lifecycle true
17464 verbose lifecycle zettlr@0.11.0~postinstall: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-b$
17465 verbose lifecycle zettlr@0.11.0~postinstall: CWD: /tmp/Zettlr
17466 silly lifecycle zettlr@0.11.0~postinstall: Args: [ '-c', 'electron-builder install-app-deps' ]
17467 silly lifecycle zettlr@0.11.0~postinstall: Returned: code: 126  signal: null
17468 info lifecycle zettlr@0.11.0~postinstall: Failed to exec postinstall script
17469 verbose stack Error: zettlr@0.11.0 postinstall: `electron-builder install-app-deps`
17469 verbose stack Exit status 126
17469 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:1$
17469 verbose stack     at emitTwo (events.js:126:13)
17469 verbose stack     at EventEmitter.emit (events.js:214:7)
17469 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:5$
17469 verbose stack     at emitTwo (events.js:126:13)
17469 verbose stack     at ChildProcess.emit (events.js:214:7)
17469 verbose stack     at maybeClose (internal/child_process.js:925:16)
17469 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
17470 verbose pkgid zettlr@0.11.0
17471 verbose cwd /tmp/Zettlr
17472 verbose Linux 4.4.0-43-Microsoft
17473 verbose argv "/usr/bin/node" "/usr/bin/npm" "install"
17474 verbose node v8.9.4
17475 verbose npm  v5.6.0
17476 error code ELIFECYCLE
17477 error errno 126
17478 error zettlr@0.11.0 postinstall: `electron-builder install-app-deps`
17478 error Exit status 126

Thanks for your help.

@damien122 damien122 changed the title problems to start dev on windows problems to start source code on windows Feb 27, 2018
@nathanlesage
Copy link
Member

Hey there,

I cannot reproduce the windows error (I am currently on Win10 Pro x64 with node v8.9.4 and npm v5.6.0 installed), but from what I see the error is produced by the codemirror indentlist plugin postinstall script.

What this script basically does is simply to create an additional file in the plugin directory of the codemirror installation. According to a quick search ELIFECYCLE errors are thrown when there is an error in the script, which would point to two potential cases:

  1. the patch-command does not work, because the necessary package is not installed. Yet, it should be installed automatically on npm install, so I think this is highly unlikely.
  2. There are insufficient write permissions to the node_modules-dir, meaning that the patch-command would fail because it is not allowed to write to node_modules/codemirror.

But I've on other occasions also noticed some complains about npm in general, so maybe try to update to npm v5.6.0 and try it again, maybe this will solve the issue.

As to your linux error, I cannot reproduce it as well, but only because I don't have a linux machine at hand currently. But the error code 126 from the postinstall-script seems to indicate write permission issues, as pointed to in this thread here.

A friend of mine has just tried to run the install scripts on linux (he's using Fedora) and it has worked there.

So I think the errors you are experiencing are pertaining to write permissions. Would you mind trying to clone the repository into your default Documents-folder in your Home directory and install without administrator-permissions in the shell? Maybe this will solve the issues.

Good luck!

@damien122
Copy link
Author

Hi @nathanlesage,

thanks for your quick answer.
I tryed to update npm to 5.6.0 and it changed something.
Also I try to run powershell with admin permission and one regular powershell and in both I got the same errors.
Do you have maybe installed some necessary packeges global?
Also I try it on a second PC (both with windows 10 x64) and on both I got this errors.

> codemirror-markdown-list-autoindent@1.0.1 postinstall C:\temp\Zettlr\node_modules\codemirror-markdown-list-autoindent
> patch -p1 -d ../codemirror < markdown-list-autoindent.patch

Der Befehl "patch" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-linux@1.3.1 (node_modules\7zip-bin-linux):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 7zip-bin-linux@1.3.1: wanted {"os":"linux","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-mac@1.0.1 (node_modules\7zip-bin-mac):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 7zip-bin-mac@1.0.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! codemirror-markdown-list-autoindent@1.0.1 postinstall: `patch -p1 -d ../codemirror < markdown-list-autoindent.patch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the codemirror-markdown-list-autoindent@1.0.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Der Befehl "patch" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
Means that the command "patch" is unkown or is writen wrong.

You can also have linux on windows. https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux
In such a WSL it was possible for me to execute the npm install command. But the npm start command was not successful.

Linux Log:

> zettlr@0.11.0 start /mnt/c/temp/Zettlr
> electron .

/mnt/c/temp/Zettlr/node_modules/electron/dist/electron: error while loading shared libraries: libgtk
-x11-2.0.so.0: cannot open shared object file: No such file or directory
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! zettlr@0.11.0 start: `electron .`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the zettlr@0.11.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Windows Log:

PS C:\temp\Zettlr> npm start

> zettlr@0.11.0 start C:\temp\Zettlr
> electron .

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\temp\Zettlr\node_modules\electron\dist\electron ENOENT
    at _errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:686:11)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zettlr@0.11.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zettlr@0.11.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@nathanlesage
Copy link
Member

Ah, this logging output helps better! I think now we can solve both of your problems!

Der Befehl "patch" ist entweder falsch geschrieben oder konnte nicht gefunden werden.

So indeed somehow the patch command does not work.

On windows I try npm install through the normal shell and I think this may solve it. I dislike PowerShell because many commands need to be explicitly routed to their correct aliases. So the German output definitely comes from PowerShell and not from node itself (b/c node is always en_US), which points to the problem that the patch command cannot be referenced from within PowerShell. I'd advise you to simply use the normal shell for npm, because this definitely works.

As to your Linux problem, I believe this is because of the Linux subsystem. As the subsystem only implements shell commands and stuff, not the graphical interface (i.e. the X11-server), this means that running a graphical program such as electron is not possible using the subsystem. This is also indicated in your logging output as it references a missing dependency libgtk-x11-2.0.so.0. This basically tells you "I couldn't find the GTK interface!" (libgtk-x11 is the main library for running graphical programs on a GTK platform such as Ubuntu or Gnome).

I think you definitely need a Virtual Machine if you like to be running an electron app on your windows machine. You could try VirtualBox, because many people I've talked to mentioned it for running Linux systems on a Windows PC (and vice versa), so it should be a good point to start.

Please tell me if it works now!

@damien122
Copy link
Author

Ok build now works and start also but after npm start the app creshed because it could not pars some files from my local Documents folder. But I don't understand why the app try to pars my files at startup?

@nathanlesage
Copy link
Member

This is just as intended.

When Zettlr starts, it needs at least one root directory, and if there hasn't been any, it defaults back to your documents folder. Then it parses the whole directory and reads in all *.txt and *.md files, opens them for read, extracts some information (such as creation date and the first 50 characters) so that it can present to you an initial list of files.

Then you can, from within the app, choose a different folder, if you wish to. Could you please provide some error information?

@damien122
Copy link
Author

damien122 commented Feb 28, 2018

How can I provide an other root dir at startup?
Unfortunatelly I can't upload screenshots here. I got an popup windows with a stacktrace and can't copy the text.

Edit: now I know how to upload screenshots here :D

@damien122
Copy link
Author

image

@nathanlesage
Copy link
Member

… well, that is an interesting error, if even node doesn't know what to do. It shouldn't happen, so I will look into it. But I think it's because of a symlink that Zettlr shouldn't be following.

As for now, until it's fixed, you can find the configuration of Zettlr in C:\Users\<your-username>\AppData\Roaming\Zettlr\config.json

There, simply replace the JSON variable projectDir with a safe directory and try to start the app again.

@damien122
Copy link
Author

Thanks, now it works. I can now start zettlr from source 😄

@nathanlesage
Copy link
Member

Good to hear! I'll try to fix the startup error in a next version, though =D

@nathanlesage
Copy link
Member

See for further discussion on these problems issue #14.

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