[OE-core] Fun with npm shrinkwrap

Jan Kiszka jan.kiszka at siemens.com
Tue Jun 6 10:17:56 UTC 2017


Hi all,

devtool add / recipetool create do not work properly /wrt shrinkwrap
when it comes to node-red-node-serialport. npm shrinkwrap finds a number
of extraneous packages and refuses to generate an output.

There are various workarounds discussed in [1]. For me this seems to
work:

diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index cb8f338b8b..8ce952bb4c 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -68,6 +68,8 @@ class NpmRecipeHandler(RecipeHandler):
     def _shrinkwrap(self, srctree, localfilesdir, extravalues, lines_before, d):
         try:
             runenv = dict(os.environ, PATH=d.getVar('PATH'))
+            bb.process.run('rm -rf node_modules', cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True)
+            bb.process.run('npm install', cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True)
             bb.process.run('npm shrinkwrap', cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True)
         except bb.process.ExecutionError as e:
             logger.warn('npm shrinkwrap failed:\n%s' % e.stdout)


But it may have unwanted side effects. So, what would be the proper way
to address this issue?

Thanks,
Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux



More information about the Openembedded-core mailing list