Yocto recipe fails to install npm package

為{幸葍}努か 提交于 2020-01-06 08:38:32

问题


I have a recipe that installed some NPM packages that worked on an older version of Yocto.

After upgrading to sumo, the recipe fails with the following error: installnpmpackages/0.0.1-r0/temp/run.do_compile.7272: npm: not found | WARNING: exit code 127 from a shell command.

I tried using the developer shell and NPM does work in that case.

The do_compile from the recipe:

do_compile() {
        # Create a working directory
        mkdir -p ${WORKDIR}/scratch

        # changing the home directory to the working directory, the .npmrc will be created in this directory
        export HOME=${WORKDIR}/scratch

        # configure cache to be in working directory
        npm set cache ${WORKDIR}/scratch/npm_cache

        # clear local cache prior to each compile
        npm cache clear

        # compile and install node modules in source directory
        cd ${WORKDIR}/scratch
        npm --arch=${TARGET_ARCH} --verbose install node-gyp
        npm --arch=${TARGET_ARCH} --verbose install connect
        npm --arch=${TARGET_ARCH} --verbose install socket.io
        #npm --arch=${TARGET_ARCH} --verbose install sqlite3
        #npm --arch=${TARGET_ARCH} --verbose install serialport
        npm --arch=${TARGET_ARCH} --verbose install express
        npm --arch=${TARGET_ARCH} --verbose install csv
        npm --arch=${TARGET_ARCH} --verbose install md5

        # clear local cache before we package. No need to copy over all this cache stuff; just need the modules.
        npm cache clear
}

Note sqlite3 and serialport are commented out as they did not work on the previous version.

What needs to be changed with sumo (vs morty) for NPM to function in a recipe?

Thank you in advance!


回答1:


I found a simple solution.

I created individual recipes using devtool add.

Here is the command used to create a recipe for the serialport npm module:

devtool add "npm://registry.npmjs.org;name=serialport;version=7.1.4"


来源:https://stackoverflow.com/questions/55538323/yocto-recipe-fails-to-install-npm-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!