From 1bdbdf3a7e09b387fa25a3fa0dc0f15188cb5331 Mon Sep 17 00:00:00 2001 From: Nisha Parrakat Date: Wed, 12 Jan 2022 09:40:57 +0100 Subject: [PATCH] nodejs_16.11.1.bb: only handle npm if configured npm-cli.js should be symlinked only when the file is present the file may not be available if the configure option is --without-npm Signed-off-by: Nisha Parrakat Signed-off-by: Khem Raj --- meta-oe/recipes-devtools/nodejs/nodejs_16.11.1.bb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_16.11.1.bb b/meta-oe/recipes-devtools/nodejs/nodejs_16.11.1.bb index 11034420aa..c8d9425387 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs_16.11.1.bb +++ b/meta-oe/recipes-devtools/nodejs/nodejs_16.11.1.bb @@ -175,8 +175,9 @@ do_install:append:class-native() { # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js # use sed on npm-cli.js because otherwise symlink is replaced with normal file and # npm-cli.js continues to use old shebang - sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js - + if [[ -f "${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js" ]]; then + sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js + fi # Install the native binaries to provide it within sysroot for the target compilation install -d ${D}${bindir} install -m 0755 ${S}/out/Release/torque ${D}${bindir}/torque @@ -189,7 +190,9 @@ do_install:append:class-native() { } do_install:append:class-target() { - sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js + if [[ -f "${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js" ]]; then + sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js + fi } PACKAGES =+ "${PN}-npm"