brrd / abricotine

Markdown editor with inline preview
GNU General Public License v3.0
2.63k stars 159 forks source link

Arch Linux: unable to build from source #63

Closed simonbcn closed 5 years ago

simonbcn commented 8 years ago
Arch Linux 64 bits
node v5.10.1
npm v3.8.6

I'm trying to install the git version with these instructions: Building and packaging but:

...
> node install.js

> Abricotine@0.3.2 postinstall /home/juan/bin/nodejs/lib/node_modules/Abricotine
> electron-rebuild && bower install

sh: electron-rebuild: command not found
npm ERR! Linux 4.4.7-1-ck
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.6
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! Abricotine@0.3.2 postinstall: `electron-rebuild && bower install`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the Abricotine@0.3.2 postinstall script 'electron-rebuild && bower install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Abricotine package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     electron-rebuild && bower install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs Abricotine
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls Abricotine
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/Abricotine/npm-debug.log

Perhaps the instruction page lacks some dependencies.

brrd commented 8 years ago

I don't understand why this error occurs, but I noticed electron-rebuild is working properly when npm install (despite this error message).

Try npm bower install to finish the install then npm start to run the app. You will have to check if spelling is working well (spell-checker is the only reason tor which electron-rebuild is used in Abricotine).

simonbcn commented 8 years ago

Can I disable the spell-checker in installation?

npm bower install or npm install bower?

brrd commented 8 years ago

Can I disable the spell-checker in installation?

No.

npm bower install or npm install bower?

Sorry, this is my mistake. The correct command is: ./node_modules/.bin/bower install Or simply bower install if you already installed bower as a global module on your computer.

simonbcn commented 8 years ago

I have installed bower globally: sudo npm install -g bower. After this:

$ bower install
bower                     invalid-meta The "name" is recommended to be lowercase, can contain digits, dots, dashes
bower MathJax#~2.5.3        not-cached https://github.com/mathjax/MathJax.git#~2.5.3
bower MathJax#~2.5.3           resolve https://github.com/mathjax/MathJax.git#~2.5.3
bower split-pane#~0.4.1     not-cached https://github.com/shagstrom/split-pane.git#~0.4.1
bower split-pane#~0.4.1        resolve https://github.com/shagstrom/split-pane.git#~0.4.1
bower codemirror#~5.1.0     not-cached https://github.com/marijnh/CodeMirror.git#~5.1.0
bower codemirror#~5.1.0        resolve https://github.com/marijnh/CodeMirror.git#~5.1.0
bower jquery#2.1.1          not-cached https://github.com/jquery/jquery-dist.git#2.1.1
bower jquery#2.1.1             resolve https://github.com/jquery/jquery-dist.git#2.1.1
bower jquery#2.1.1            checkout 2.1.1
bower MathJax#~2.5.3          checkout 2.5.3
bower codemirror#~5.1.0       checkout 5.1.0
bower jquery#2.1.1            resolved https://github.com/jquery/jquery-dist.git#2.1.1
bower split-pane#~0.4.1       checkout 0.4.1
bower codemirror#~5.1.0       resolved https://github.com/marijnh/CodeMirror.git#5.1.0
bower split-pane#~0.4.1       resolved https://github.com/shagstrom/split-pane.git#0.4.1
bower jquery#1.11.1         not-cached https://github.com/jquery/jquery-dist.git#1.11.1
bower jquery#1.11.1            resolve https://github.com/jquery/jquery-dist.git#1.11.1
bower jquery#1.11.1           checkout 1.11.1
bower MathJax#~2.5.3          progress Receiving objects:   6% (2240/32697), 4.61 MiB | 900.00 KiB/s
bower MathJax#~2.5.3          progress Receiving objects:   7% (2319/32697), 6.31 MiB | 1.14 MiB/s
bower jquery#1.11.1           resolved https://github.com/jquery/jquery-dist.git#1.11.1
bower MathJax#~2.5.3          progress Receiving objects:   7% (2470/32697), 7.46 MiB | 1.33 MiB/s
bower MathJax#~2.5.3          progress Receiving objects:  35% (11444/32697), 9.95 MiB | 1.69 MiB/s
bower MathJax#~2.5.3          progress Receiving objects:  90% (29428/32697), 13.29 MiB | 2.19 MiB/s
bower MathJax#~2.5.3          progress Receiving objects:  95% (31063/32697), 15.06 MiB | 2.46 MiB/s
bower MathJax#~2.5.3      invalid-meta The "name" is recommended to be lowercase, can contain digits, dots, dashes
bower MathJax#~2.5.3          resolved https://github.com/mathjax/MathJax.git#2.5.3

Please note that,
    split-pane#0.4.1 depends on jquery#1.11.1 which resolved to jquery#1.11.1
    Abricotine depends on jquery#2.1.1 which resolved to jquery#2.1.1
Resort to using jquery#2.1.1 which resolved to jquery#2.1.1
Code incompatibilities may occur.

bower jquery#2.1.1             install jquery#2.1.1
bower codemirror#~5.1.0        install codemirror#5.1.0
bower split-pane#~0.4.1        install split-pane#0.4.1
bower MathJax#~2.5.3           install MathJax#2.5.3

jquery#2.1.1 bower_components/jquery

codemirror#5.1.0 bower_components/codemirror

split-pane#0.4.1 bower_components/split-pane
└── jquery#2.1.1

MathJax#2.5.3 bower_components/MathJax

After this:

$ npm start      

> Abricotine@0.3.2 start /tmp/Abricotine
> electron .

sh: electron: command not found

npm ERR! Linux 4.4.7-1-ck
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.6
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! Abricotine@0.3.2 start: `electron .`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the Abricotine@0.3.2 start script 'electron .'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Abricotine package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     electron .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs Abricotine
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls Abricotine
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/Abricotine/npm-debug.log

It invokes electron but it doesn't exist.

brrd commented 8 years ago

electron should definitely exist after npm install. Try npm install again. Depending on the way you installed node on your computer, you may need to run install as super-user.

simonbcn commented 8 years ago

It works now but I have done so many things that I don't know what was really the problem.

brrd commented 8 years ago

Well, I'm sorry but I can't reproduce this issue. I tried it once again right now (Ubuntu 14.04 x64) and everything is working as expected:

git clone https://github.com/brrd/Abricotine.git
cd ./Abricotine
npm install

Obviously the issue came from npm install which didn't work properly, but I don't understand what exactly happened...

z3ntu commented 8 years ago

Same problem again (also Arch Linux)

48254 silly postinstall Abricotine@0.3.3 /build/abricotine/src/Abricotine-0.3.3/Abricotine-0d29ed2e
48255 info lifecycle Abricotine@0.3.3~postinstall: Abricotine@0.3.3
48256 verbose lifecycle Abricotine@0.3.3~postinstall: unsafe-perm in lifecycle true
48257 verbose lifecycle Abricotine@0.3.3~postinstall: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/build/abricotine/src/Abricotine-0.3.3/node_modules/.bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
48258 verbose lifecycle Abricotine@0.3.3~postinstall: CWD: /build/abricotine/src/Abricotine-0.3.3
48259 silly lifecycle Abricotine@0.3.3~postinstall: Args: [ '-c', 'electron-rebuild' ]
48260 silly lifecycle Abricotine@0.3.3~postinstall: Returned: code: 255  signal: null
48261 info lifecycle Abricotine@0.3.3~postinstall: Failed to exec postinstall script
48262 verbose stack Error: Abricotine@0.3.3 postinstall: `electron-rebuild`
48262 verbose stack Exit status 255
48262 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:242:16)
48262 verbose stack     at emitTwo (events.js:106:13)
48262 verbose stack     at EventEmitter.emit (events.js:191:7)
48262 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
48262 verbose stack     at emitTwo (events.js:106:13)
48262 verbose stack     at ChildProcess.emit (events.js:191:7)
48262 verbose stack     at maybeClose (internal/child_process.js:852:16)
48262 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)

When I manually go into the build directory, set the PATH to /usr/lib/node_modules/npm/bin/node-gyp-bin:/build/abricotine/src/Abricotine-0.3.3/node_modules/.bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl (as the script does) and execute electron-rebuild I also get the error message:

Process exited with code: 127                                                                
Error: Process exited with code: 127                                                         
    at ChildProcess.<anonymous> (/build/abricotine/src/Abricotine-0.3.3/node_modules/electron-rebuild/lib/spawn.js:55:26)                                                                 
    at emitTwo (events.js:106:13)                                                            
    at ChildProcess.emit (events.js:191:7)                                                   
    at maybeClose (internal/child_process.js:852:16)                                         
    at Socket.<anonymous> (internal/child_process.js:323:11)                                 
    at emitOne (events.js:96:13)                                                             
    at Socket.emit (events.js:188:7)                                                         
    at Pipe._handle.close [as _onclose] (net.js:492:12)  

I am doing this in a clean Arch chroot (nearly no packages installed), except the packages npm (+dependencies) and python2.

brrd commented 8 years ago

Obviously this issue is specific to ArchLinux (everything works fine on Debian/Ubuntu at least).

This path /usr/lib/node_modules/npm/bin/node-gyp-bin is really weird in my opinion. npm is supposed to search dependencies in the local node_modules, but it looks like it is trying to load it from global modules here... That would explain the first issue reported here (missing "electron" command).

Could you tell what happen when you try to run the app : $ npm start?

What happen if you try to $ npm install -g electron-rebuild and rerun the install?

z3ntu commented 8 years ago
$ npm start

> Abricotine@0.3.3 start /build/abricotine/src/Abricotine-0.3.3
> electron .

/build/abricotine/src/Abricotine-0.3.3/node_modules/electron-prebuilt/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! Linux 4.6.3-1-ARCH
npm ERR! argv "/usr/bin/node" "/build/abricotine/src/Abricotine-0.3.3/node_modules/.bin/npm" "start"
npm ERR! node v6.3.0
npm ERR! npm  v3.10.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! Abricotine@0.3.3 start: `electron .`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the Abricotine@0.3.3 start script 'electron .'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Abricotine package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     electron .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs Abricotine
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls Abricotine
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /build/abricotine/src/Abricotine-0.3.3/npm-debug.log

(probably a missing dependency)

I will try the build again.

brrd commented 8 years ago

/build/abricotine/src/Abricotine-0.3.3/node_modules/electron-prebuilt/dist/electron: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

This looks like another issue. Abricotine uses an old version of Electron, upgrade is planned. This would maybe solve this issue.

z3ntu commented 8 years ago

The electron-rebuild thing is definitely an issue when non-standard paths (?) are set.

I cloned git clone git@github.com:brrd/Abricotine.git into my /tmp directory, ran npm install and everything went fine (npm start worked). I am building in the chroot right now again manually. EDIT: Worked there too... Definitely an issue with the way makepkg handles things (or node/npm/...)

brrd commented 8 years ago

I cloned git clone git@github.com:brrd/Abricotine.git into my /tmp directory, ran npm install and everything went fine (npm start worked).

I don't understand what is different from your first attempt. Did you install electron-rebuilt globally this time?

z3ntu commented 8 years ago

Actually not... I will try again with makepkg and electron-rebuild installed globally. EDIT: Installing electron-rebuild globally (created a PKGBUILD for it) solved it.

brrd commented 8 years ago

??? What is makepkg? Please don't confuse Abricotine build with Arch Linux package build. We are talking about Abricotine build here. I don't understand what you did different to make it work on your second try.

z3ntu commented 8 years ago

makepkg is a program, which uses the instructions in a PKGBUILD file and builds you a package which you can install via the package manager (pacman).

makepkg is a script to automate the building of packages. The requirements for using the script are a build-capable Unix platform and a PKGBUILD.

  1. Manually installing (git clone, npm install, npm start) works without problems.
  2. When you use makepkg to basically download the archive, extract it, and run npm install this error occurs.
  3. When you first install electron-rebuild globally (either via npm or via the package I created for Arch Linux) and then run makepkg it works as expected and there are no errors.
brrd commented 8 years ago

Okay, I understand now! This was the missing information: you are trying to create a package for Arch Linux. This explains why npm paths are not working as usual.

In my opinion, creating another package is not the best solution (because electron-rebuild is already bundled in Abricotine).

Have you considered alternative solutions:

  1. Adding ./node_modules/.bin/electron-rebuild to PATH when running the install (this is actually how npm is supposed to work).
  2. Or (if the first options is not working) trying to replace this line with the real relative path:
    "postinstall": "./node_modules/.bin/electron-rebuild",

(If this second solution works then we can commit the change in Abricotine source).

z3ntu commented 8 years ago

Actually there already is a package for it (see here and here). The problem with it (this issue I am writing about) is that something can't find something (NOTE: only for some users including me, some don't have a problem at all) I also believe that it finds the script in node_modules/.bin/electron-rebuild because the 127 error gets thrown at /build/abricotine/src/Abricotine-0.3.3/node_modules/electron-rebuild/lib/spawn.js:55:26.

npm already manually sets the $PATH variable to /usr/lib/node_modules/npm/bin/node-gyp-bin:/build/abricotine/src/Abricotine-0.3.3/node_modules/.bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

brrd commented 8 years ago

I don't know what to do... This is probably an issue with electron-rebuild.

johnnydvc commented 7 years ago

npm ERR! Linux 4.8.4-1-MANJARO npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" npm ERR! node v6.9.1 npm ERR! npm v3.10.9 npm ERR! code ELIFECYCLE npm ERR! Abricotine@0.4.0 postinstall: electron-rebuild npm ERR! Exit status 126 npm ERR! npm ERR! Failed at the Abricotine@0.4.0 postinstall script 'electron-rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the Abricotine package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! electron-rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs Abricotine npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls Abricotine npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /tmp/yaourt-tmp-e/aur-abricotine/src/Abricotine-0.4.0/npm-debug.log

49420 verbose stack Error: Abricotine@0.4.0 postinstall:electron-rebuild 49420 verbose stack Exit status 126 49420 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16) 49420 verbose stack at emitTwo (events.js:106:13) 49420 verbose stack at EventEmitter.emit (events.js:191:7) 49420 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14) 49420 verbose stack at emitTwo (events.js:106:13) 49420 verbose stack at ChildProcess.emit (events.js:191:7) 49420 verbose stack at maybeClose (internal/child_process.js:877:16) 49420 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 49421 verbose pkgid Abricotine@0.4.0

zommuter commented 7 years ago

I had no trouble installing it using https://aur.archlinux.org/packages/abricotine/

brrd commented 5 years ago

I'm closing this issue since electron was upgraded in Abricotine 0.7.0.