NPM package recipe, npm not found


Bel Hadj Salem Talel <bhstalel@...>
 

Hi,

I'm trying to make a recipe for an NPM package.
The source files are local.
Here is my recipe:

LICENSE="CLOSED"
SRC_URI+="file://sense-web_${PV].zip"
S=${WORKDIR}
DEPENDS+="nodejs"
do_compile(){
  export HOME=${S}
  npm install
  npm run-script build
}

The following error appears:

Log data follows:
| DEBUG: Executing shell function do_compile
| /media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linux/sense-web/1.0-r0/temp/run.do_compile.11622: 107: /media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linux/sense-web/1.0-r0/temp/run.do_compile.11622: npm: not found
| WARNING: exit code 127 from a shell command.
| ERROR: Execution of '/media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linux/sense-web/1.0-r0/temp/run.do_compile.11622' failed with exit code 127:
| /media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linux/sense-web/1.0-r0/temp/run.do_compile.11622: 107: /media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linux/sense-web/1.0-r0/temp/run.do_compile.11622: npm: not found
| WARNING: exit code 127 from a shell command.
|

I did the same steps in devshell of nodejs and everything is correct.
I tried to add the recipe with devtool , devtool add sense-web_1.0.zip but it failed.

Any ideas?
Thanks, Talel


Quentin Schulz
 

Hi Talel,

On Wed, Oct 07, 2020 at 07:51:58AM -0700, Bel Hadj Salem Talel wrote:
Hi,

I'm trying to make a recipe for an NPM package.
The source files are local.
Here is my recipe:

LICENSE="CLOSED"
SRC_URI+="file://sense-web_${PV].zip"
S=${WORKDIR}
DEPENDS+="nodejs"
Just guessing but probably nodejs-native here?

Although, you might want to have a look at the npm.bbclass and try to
inherit it. Considering how complex the class looks like, it might be
easier to get started with the class and fix what needs to be fixed.

Quentin


Bel Hadj Salem Talel <bhstalel@...>
 

You are right, it needs nodejs-native in DEPENDS. Now it is working
Thanks a lot.