Skip to contentSkip to conversation

classes/npm: use npm install to do installation

PATCH New Paul Eggleton 1 participant 2 messages Oct 31, 2016

lore
Share & tools
lore
#0 lore raw

cover classes/npm: use npm install to do installation

The following changes since commit b18fa5f2f2f46afc6fdc58f4d29679dea9c36c43:

Remove LIC_FILES_CHKSUM from recipes without SRC_URI (2016-10-28 11:27:33 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib paule/npm-install-fix
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/npm-install-fix

Paul Eggleton (1):
classes/npm: use npm install to do installation

 meta/classes/npm.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.5.5
#1 lore raw

PATCH 1/1 classes/npm: use npm install to do installation

Using "npm install" instead of "cp -a" is the more correct thing to be doing here, and ensures that symlinks for executable scripts are put into ${prefix}/bin. (I'd prefer ${bindir}, but npm does not allow specifying paths at that level - only a prefix.)

Fixes [YOCTO #10460].

---
 meta/classes/npm.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/classes/npm.bbclass +5 -1
index fce4c11..43228c5 100644
@@ -33,7 +33,11 @@ npm_do_compile() {
 
 npm_do_install() {
 	mkdir -p ${NPM_INSTALLDIR}/
-	cp -a ${S}/* ${NPM_INSTALLDIR}/ --no-preserve=ownership
+	npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry
+	if [ -d ${D}${prefix}/etc ] ; then
+		# This will be empty
+		rmdir ${D}${prefix}/etc
+	fi
 }
 
 python populate_packages_prepend () {
Signature · 1 line
2.5.5