You are not logged in.

#1 2017-07-27 23:39:44

sum01
Member
Registered: 2017-05-22
Posts: 26
Website

Best way to handle "npm run"?

Current pkgbuild: https://aur.archlinux.org/packages/vcash-electron/
I know I'm not doing the package() part correct, which is why I'm asking here..

I've seen the recommendations on doing

npm install -g --user root --prefix "$pkgdir"/usr

but this pkg requires doing

npm prune && npm run dist-linux

which creates a folder "$srcdir/$pkgname-$pkgver/dist/linux-unpacked".

Is there anything I could/should be doing that I seem to just not be able to find topics about, or should I just move the whole "linux-unpacked" folder into /usr/share/$pkgname and call it a day?

Offline

#2 2017-07-27 23:49:05

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Best way to handle "npm run"?

Well, I kind of hate npm and think you shouldn't use it at all. tongue

But that may not be an option, so what I ended up doing for that one nodejs PKGBUILD I maintain was to install it inplace in build(), then implement my own `make install` functionality in package() via mkdir -p and cp: https://aur.archlinux.org/pkgbase/rapydscript-ng-git/

FWIW I am a *big* fan of separating out build() and package() -- I also use the workflow `$python setup.py build && $python setup.py install --skip-build`, even for arch=(any) packages.

Last edited by eschwartz (2017-07-27 23:52:37)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2017-07-28 02:15:59

sum01
Member
Registered: 2017-05-22
Posts: 26
Website

Re: Best way to handle "npm run"?

I don't really see how I can use what you did for this pkgbuild?

If I don't do

npm run dist-linux

then the bin and libs are never created.

Basically, I was just asking to see if there's a clean way to install the bin and libs in their correct /usr/bin and /usr/lib places?

I've tried doing it manually after npm install && npm prune && npm run dist-linux

install -Dsm755 "$srcdir/path/to/bin" "$pkgdir/usr/bin/binName"
install -Dsm755 "$srcdir/path/to/libs" "$pkgdir/usr/bin/libNames"

(just a quick example) but then it throws

FATAL:content_main_runner.cc(759)] Check failed: base::i18n::InitializeICU().

Offline

#4 2017-07-28 02:24:46

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Best way to handle "npm run"?

I don't know how this particular software works or what folder structure it uses. I don't even know what files it contains. Is there something specific that is wrong with the current PKGBUILD in the AUR?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2017-07-28 02:26:18

sum01
Member
Registered: 2017-05-22
Posts: 26
Website

Re: Best way to handle "npm run"?

No, it does work, I was mainly asking if/how I could improve it to install how you'd expect (aka binaries in /usr/bin, libs in /usr/lib, etc) rather than just running everything out of a folder.

I guess it's not a big deal if I can't figure something out.

Offline

#6 2017-07-28 02:39:34

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Best way to handle "npm run"?

Is that one of those apps that basically just downloads a prebuilt copy of electron which runs code in resources/app/ ?

Because if so, you could probably move resources/app/ to e.g. "$pkgdir"/usr/share/$pkgname-app, then create a launcher shellscript that runs `electron /path/to/app`, and it will work fine.
Using the system electron package is a good thing. smile


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2017-07-28 03:14:43

sum01
Member
Registered: 2017-05-22
Posts: 26
Website

Re: Best way to handle "npm run"?

That seems to maybe be the right idea, but it throws a

(electron:29573): Gdk-WARNING **: gdkwindow-x11.c:5573 drawable is not a native X11 window

when I tried that route

Offline

#8 2017-07-28 11:19:17

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: Best way to handle "npm run"?

sum01 wrote:

That seems to maybe be the right idea, but it throws a

(electron:29573): Gdk-WARNING **: gdkwindow-x11.c:5573 drawable is not a native X11 window

when I tried that route

Looks like you are running it in a wayland session, have you tried it from an X sesssion ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#9 2017-07-28 14:30:26

sum01
Member
Registered: 2017-05-22
Posts: 26
Website

Re: Best way to handle "npm run"?

No idea how.

Offline

#10 2017-07-28 14:38:05

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Best way to handle "npm run"?

sum01 wrote:

No idea how.

That's really the wrong answer in many ways.

It's ok to not be familiar, but you should be able to find out quite quickly.  Check the wiki.  There's *definitely* no way anyone here could tell you as we have no idea how you start your session and/or what session you are currently running: you know these things.  I could take a wild guess that the only way you could be so ignorant of these things is if you were running gnome and gdm, in which case:
https://wiki.archlinux.org/index.php/GN … ting_GNOME

Although I'd also guess that you'd probably be using some arch-derivative distro too...


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB