【问题标题】:Yocto recipe fails to install npm packageYocto recipe 无法安装 npm 包
【发布时间】:2019-04-05 15:01:23
【问题描述】:

我有一个配方,它安装了一些适用于旧版本 Yocto 的 NPM 包。

升级到 sumo 后,配方失败并出现以下错误: installnpmpackages/0.0.1-r0/temp/run.do_compile.7272:npm:未找到 |警告:从 shell 命令退出代码 127。

我尝试使用开发者 shell,NPM 在这种情况下确实有效。

配方中的 do_compile:

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
}

注意 sqlite3 和 serialport 被注释掉,因为它们在以前的版本中不起作用。

为了让 NPM 在配方中发挥作用,需要对 sumo(与 morty 相比)进行哪些更改?

提前谢谢你!

【问题讨论】:

    标签: npm yocto


    【解决方案1】:

    我找到了一个简单的解决方案。

    我使用 devtool add 创建了单独的食谱。

    这是用于为 serialport npm 模块创建配方的命令:

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

    【讨论】:

    • 嘿,丹。我们将如何将包添加到操作系统中?我已经看到我们可以使用 devtool deploy 来部署它。但是我们不能把这个包添加到 bblayers 中吗?就像我们对其他包(如 python)所做的那样?
    • 我收到错误:URL:'npm://registry.npmjs.org/;name=sqlite3;version=5.0.2' 缺少必需的参数 'Parameter 'package' required'跨度>
    • 我遇到了和@krishna 一样的错误,有人找到解决办法了吗?
    • @alex88,只需附加 package=sqlite3
    【解决方案2】:

    我正在回复@Hsn 评论,因为我的帐户是新帐户并且我没有 50 声望。

    如果您能够使用 devtool 添加配方并且它有效,您也可以使用 devtool 完成配方的工作并告诉 devtool 您要将配方放入哪个元中:

    devtool finish recipe_name meta-destination
    

    并且为了将其放入您最终的操作系统 rootfs,您需要将其添加到您的图像 bb 文件中,例如:image-dev.bb:

    IMAGE_INSTALL_append += "recipe_name"
    

    还要确保保存你的食谱的元数据存在于你的 bblayers.conf 中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-31
      • 2017-12-12
      • 1970-01-01
      • 2016-11-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多