Integrating npm into install?

Paul Wicks

I've got a python app that uses some javascript assets that are normally built via webpack. In a normal build, the process is as follows:

* run "npm install" to get all the javascript dependencies
* run "npm build", a custom task in my package.json file that invokes webpack to build the assets and place them where the python install can find them.
* run "python install" to build and install the python part of the app

What's the best/most correct way to integrate this into a yocto recipe? My current approach is to have the main recipe "inherit setuptools3" and then add the following:

do_run_npm_install() {
    bbplain "Running npm install, this may take a few minutes..."
    npm install
    npm run build

addtask run_npm_install before do_compile

However, this fails with an "npm: not found" error.

-Paul Wicks

Join { to automatically receive all group messages.