From 5669698ae5ab99a95496361456bb26b6409f0692 Mon Sep 17 00:00:00 2001 From: Dvorkin Dmitry Date: Fri, 26 Jul 2019 10:03:57 +0300 Subject: [PATCH 1/3] Building any npm package in OE/Yocto env run into error: | npm ERR! Cannot read property 'replace' of null , case registry may not exist in the restricted env. --- lib/install/inflate-shrinkwrap.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/install/inflate-shrinkwrap.js b/lib/install/inflate-shrinkwrap.js index 395cc11191309..4b7c87aa43258 100644 --- a/lib/install/inflate-shrinkwrap.js +++ b/lib/install/inflate-shrinkwrap.js @@ -74,7 +74,9 @@ function quotemeta (str) { } function tarballToVersion (name, tb) { - const registry = quotemeta(npm.config.get('registry')) + var x = npm.config.get('registry'); + if ( x === null) x = ''; + const registry = quotemeta(x) .replace(/https?:/, 'https?:') .replace(/([^/])$/, '$1/') let matchRegTarball From 2967b7d5e6ffc6e4de3f38062ba6790895e3ca56 Mon Sep 17 00:00:00 2001 From: dmitrydvorkin Date: Fri, 26 Jul 2019 10:41:28 +0300 Subject: [PATCH 2/3] Update inflate-shrinkwrap.js fix patch syntax --- lib/install/inflate-shrinkwrap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/install/inflate-shrinkwrap.js b/lib/install/inflate-shrinkwrap.js index 4b7c87aa43258..f2c76d4b440cd 100644 --- a/lib/install/inflate-shrinkwrap.js +++ b/lib/install/inflate-shrinkwrap.js @@ -74,8 +74,8 @@ function quotemeta (str) { } function tarballToVersion (name, tb) { - var x = npm.config.get('registry'); - if ( x === null) x = ''; + var x = npm.config.get('registry') + if (x === null) x = ''; const registry = quotemeta(x) .replace(/https?:/, 'https?:') .replace(/([^/])$/, '$1/') From ac978539c12b118fcd26ba467498657d4a277fd9 Mon Sep 17 00:00:00 2001 From: dmitrydvorkin Date: Fri, 26 Jul 2019 13:12:34 +0300 Subject: [PATCH 3/3] Update inflate-shrinkwrap.js fix syntax --- lib/install/inflate-shrinkwrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/install/inflate-shrinkwrap.js b/lib/install/inflate-shrinkwrap.js index f2c76d4b440cd..c4b9aaadfa632 100644 --- a/lib/install/inflate-shrinkwrap.js +++ b/lib/install/inflate-shrinkwrap.js @@ -75,7 +75,7 @@ function quotemeta (str) { function tarballToVersion (name, tb) { var x = npm.config.get('registry') - if (x === null) x = ''; + if (x === null) x = '' const registry = quotemeta(x) .replace(/https?:/, 'https?:') .replace(/([^/])$/, '$1/')