You are not logged in.

#1 2019-02-17 13:54:06

avanc
Member
Registered: 2010-12-21
Posts: 12

Additional Node-RED nodes

Hello,

I want to install additional nodes for Node-RED (https://aur.archlinux.org/packages/nodejs-node-red/). This is my first draft of a PKGBUILD:

_npmname=node-red-contrib-fritz
_npmver=1.3.1
pkgname=${_npmname}
pkgver=${_npmver}
pkgrel=1
pkgdesc="Node-Red node for accessing fritzbox."
arch=(any)
url="https://nodered.org"
license=(APACHE)
depends=('nodejs' 'nodejs-node-red')
makedepends=('npm')
optdepends=()
source=(https://registry.npmjs.org/$_npmname/-/$_npmname-$_npmver.tgz)
noextract=($_npmname-$_npmver.tgz)
sha256sums=('9b348ca5ab8a21bf1e8b1867b4571abf2a7b7d1ad2dbd062f5c76b349e8c8f91')

package() {
  mkdir -p ${pkgdir}/usr/lib/node_modules
  cd ${pkgdir}/usr/lib/node_modules
  npm install --user root --prefix ${pkgdir}/usr/lib/node_modules/lib/node_modules/node-red/ $_npmname@$_npmver
}

However, the problem is how npm and nodejs handle dependencies. They are stored within the node_modules folder (e.g. /usr/lib/node_modules/lib/node_modules/node-red/node_modules/). After installation of Node-RED it contains e.g. the module asn1. However, the above PKGBUILD will also contain asn1. Thus, I get a conflict.

To do everything the Arch way, we need packages for each nodejs module required by Node-RED and install them separately. However, with about 300 modules needed by Node-RED, this wouldn't make fun...

Are there any best practices how to handle npm packages.

Thanks
Sven

Offline

Board footer

Powered by FluxBB