mirror of
https://git.yoctoproject.org/poky
synced 2026-04-13 23:02:30 +02:00
npm: fix node and npm default directory conflict
Fixes [YOCTO #13349] When dealing with node modules which have declared "bin" files [1], npm will create a link in '/usr/bin' with a relative link to '../lib/node_modules/<module bin file>'. The commitse9270af429and2713d9bcc3explicitely use '/usr/lib/node/' as install directory, but does not care about the "bin" symbolic linked files. In order to keep valid links, and to keep it as simple as possible, the path '/usr/lib/node_modules/' is used as install directory for npm. And a symbolic link is created to have a valid '/usr/lib/node/' path, needed for node. [1]: https://docs.npmjs.com/files/package.json#bin (From OE-Core rev: 67846b3b2d2d45401d500bff5cf3d4d71c003f7a) Signed-off-by: Jean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
0330298551
commit
7a779a1351
@@ -10,7 +10,7 @@ def node_pkgname(d):
|
||||
|
||||
NPMPN ?= "${@node_pkgname(d)}"
|
||||
|
||||
NPM_INSTALLDIR = "${libdir}/node/${NPMPN}"
|
||||
NPM_INSTALLDIR = "${libdir}/node_modules/${NPMPN}"
|
||||
|
||||
# function maps arch names to npm arch names
|
||||
def npm_oe_arch_map(target_arch, d):
|
||||
@@ -55,7 +55,7 @@ npm_do_install() {
|
||||
mkdir -p ${D}${libdir}/node_modules
|
||||
local NPM_PACKFILE=$(npm pack .)
|
||||
npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry ${NPM_PACKFILE}
|
||||
mv ${D}${libdir}/node_modules ${D}${libdir}/node
|
||||
ln -fs node_modules ${D}${libdir}/node
|
||||
if [ -d ${D}${prefix}/etc ] ; then
|
||||
# This will be empty
|
||||
rmdir ${D}${prefix}/etc
|
||||
@@ -85,6 +85,8 @@ python populate_packages_prepend () {
|
||||
}
|
||||
|
||||
FILES_${PN} += " \
|
||||
${bindir} \
|
||||
${libdir}/node \
|
||||
${NPM_INSTALLDIR} \
|
||||
"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user