[OE-core] [PATCH] classes/npm: Fix install to use offline option

Davis, Michael michael.davis at essvote.com
Fri Nov 3 22:03:06 UTC 2017


Just an update on this for Philippe and any interested parties.
I started down the line of grabbing the patch and was indeed able to get the tars to add into the cache.  I was also able to get the system to build offline with some manual tweaking.
The main issue I am running into now is that we need a full shrinkwrap after npm install to get the proper information for the cache to pick things up.
This will cause pretty sizable rewrites to how the npm fetcher currently functions, maybe the recipe generator too.

It will be awhile before I have the free time to attempt to something like that so if anyone wants to pick up where I left off send me an email. 
I can supply you with details of what I have done so far.


-----Original Message-----
From: Davis, Michael 
Sent: Friday, November 03, 2017 9:39 AM
To: 'Philippe Coval'; openembedded-core at lists.openembedded.org
Subject: RE: [OE-core] [PATCH] classes/npm: Fix install to use offline option

Npm v4/v6 have a patch to allow the --no-registry to work.  It was taken out in the transition to Node 8 since the cache system is completely different.
Unfortunately this doesn't work for nodev8 / npmv5 so the offline build on master/rocko is completely broken.
I am trying to get something working by adding the dependency tar.gz directly into the cache manually before the build, but I am running into a npm bug.
https://github.com/nodejs/help/issues/944


-----Original Message-----
From: openembedded-core-bounces at lists.openembedded.org [mailto:openembedded-core-bounces at lists.openembedded.org] On Behalf Of Philippe Coval
Sent: Friday, November 03, 2017 5:54 AM
To: openembedded-core at lists.openembedded.org
Subject: [OE-core] [PATCH] classes/npm: Fix install to use offline option

Option --no-registry seems deprecated or even non supported for ages,
while --offline fixed the problem on install task.

Issue can be reproduced using:

  devtool add "npm://registry.npmjs.org;name=epoll;version=latest"
  bitbake epoll

  | DEBUG: Executing shell function do_install
  (...)
  | npm ERR! argv ".../node" ".../npm" "install" (...) "--production" "--no-registry"
  | npm ERR! node v6.11.0
  | npm ERR! npm  v3.10.10
  | npm ERR! registry URL is required

And also from log file ".../epoll/1.0.0-r0/npmpkg/npm-debug.log":

   silly mapToRegistry using default registry
   41 silly mapToRegistry registry null
   42 verbose stack AssertionError: registry URL is required
   42 verbose stack     at Conf.getCredentialsByURI (.../get-credentials-by-uri.js:8:3)

More relevent insights:
https://github.com/npm/npm/issues/2568#

Signed-off-by: Philippe Coval <philippe.coval at osg.samsung.com>
---
 meta/classes/npm.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index a69bedb..dfd1ffe 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -45,7 +45,7 @@ npm_do_install() {
 	# be created in this directory
 	export HOME=${WORKDIR}
 	mkdir -p ${NPM_INSTALLDIR}/
-	npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry
+	npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --offline
 	if [ -d ${D}${prefix}/etc ] ; then
 		# This will be empty
 		rmdir ${D}${prefix}/etc
-- 
1.9.1

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core at lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core



More information about the Openembedded-core mailing list