You are not logged in.
I created a PKGBUILD today to get an NPM package on the AUR but am having trouble building it locally on my machine. I've sent it to some friends of mine to test it and they're able to build it just fine when using makepkg. I, however, get the following error:
==> Making package: alacritty-themes 2.0.2-1 (Mon 23 Nov 2020 19:29:32 GMT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found alacritty-themes-2.0.2.tgz
==> Validating source files with md5sums...
alacritty-themes-2.0.2.tgz ... Passed
==> Extracting sources...
==> Removing existing $pkgdir/ directory...
==> Entering fakeroot environment...
==> Starting package()...
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path /home/ben/Development/alacritty-themes/pkg/alacritty-themes/usr
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, lstat '/home/ben/Development/alacritty-themes/pkg/alacritty-themes/usr'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ben/Development/alacritty-themes/src/npm-cache/_logs/2020-11-23T19_29_41_103Z-debug.log
==> ERROR: A failure occurred in package().
Aborting...
I was following this guide to create the PKGBUILD (as it's my first time) and I think I followed it pretty much to the letter?
One thing I wondered was I recently installed nvm and could it be messing with my Node/NPM installation or config or something?
Here's the PKGBUILD in question:
_npmname=alacritty-themes
pkgname=${_npmname}
pkgver=2.0.2
pkgrel=1
pkgdesc="A utility for choosing and applying Alacritty terminal themes."
arch=(any)
url="https://github.com/rajasegar/alacritty-themes"
license=("MIT")
depends=("nodejs")
makedepends=("npm" "jq")
source=("https://registry.npmjs.org/${_npmname}/-/${_npmname}-${pkgver}.tgz")
noextract=("${pkgname}-${pkgver}.tgz")
md5sums=('3d94583d23aaccba842956e25454fd92')
package() {
npm install -g --cache "${srcdir}/npm-cache" --user root --prefix "${pkgdir}/usr" "${srcdir}/${pkgname}-${pkgver}.tgz"
# Non-deterministic race in npm gives 777 permissions to random directories.
# See https://github.com/npm/cli/issues/1103 for details.
find "${pkgdir}/usr" -type d -exec chmod 755 {} +
# npm gives ownership of ALL FILES to build user
# https://bugs.archlinux.org/task/63396
chown -R root:root "${pkgdir}"
# Remove references to $pkgdir
find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d'
# Remove references to $srcdir
local tmppackage="$(mktemp)"
local pkgjson="$pkgdir/usr/lib/node_modules/$pkgname/package.json"
jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" > "$tmppackage"
mv "$tmppackage" "$pkgjson"
chmod 644 "$pkgjson"
}
Last edited by silverben10 (2020-11-24 11:11:52)
Offline
So why the noextract=("${pkgname}-${pkgver}.tgz")? How else would you get a /home/ben/Development/alacritty-themes/pkg/alacritty-themes/usr?
Edit: I guess NPM is supposed to create it? My guess would be to check the installed versions of NPM and it's dependencies and see if there's any mismatches between working and non-working systems.
Last edited by Ziusudra (2020-11-23 23:55:58)
Offline
So why the noextract=("${pkgname}-${pkgver}.tgz")? How else would you get a /home/ben/Development/alacritty-themes/pkg/alacritty-themes/usr?
Edit: I guess NPM is supposed to create it? My guess would be to check the installed versions of NPM and it's dependencies and see if there's any mismatches between working and non-working systems.
Yep, I went and checked the version on the working system, and mine was a much newer version of NPM (I now remember updating NPM through itself earlier this week) so I guess that was causing the problem.
I downgraded back to the working version and, surprise surprise, it's all working fine now. Thanks for the help!
Offline