如何将 Nodejs 包添加到 Yocto?
我想要一个支持nodejs的操作系统。在我的 yocto 项目中的 layer.conf 文件中,我添加 IMAGE_INSTALL_append =“nodejs” IMAGE_INSTALL_append =“nodejs-npm” 这导致烘焙后有一个支持 Nodejs 的操作系统。现在我想添加一些 NPM 包,例如 basic-auth 等。 请你帮帮我好吗? 亲切的问候。
I would like to have an OS which support nodejs. In my yocto project at layer.conf file I add
IMAGE_INSTALL_append = " nodejs"
IMAGE_INSTALL_append = " nodejs-npm"
which result in to have an OS with nodejs support afer bake. Now I want to add some NPM packages also like basic-auth etc.
would you please help me.
kind regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了将
npm
包添加到您的映像中,您需要为其创建一个配方。Yocto 有一个 npm 源方案处理程序,您可以使用registry.npmjs.org 创建一个配方来获取您想要的包。
使用 devtool 创建配方:
您也可以设置特定版本。
配方如下:
它可以正确编译。
使用
devtool
测试后,您可以将其移动到自定义层:有关
npm
处理的更多信息,请检查此 链接我鼓励您在其官方文档中阅读有关 Yocto
NPM
处理的更多信息 链接编辑:
如果遇到错误:
只需将
name
更改为package
:In order to add an
npm
package into your image, you need to create a recipe for it.Yocto has an
npm
source scheme handler, and you can useregistry.npmjs.org
to create a recipe fetching your wanted package.Create a recipe with devtool:
You can set a specific version as well.
The recipe would be the following:
It compiles correctly.
You can move it to your custom layer after testing it with
devtool
:For more information about
npm
handling check this linkI encourage you to read more about Yocto
NPM
handling in their official documentation in this linkEDIT:
If you encounter the error:
just change
name
topackage
:您可以在 Yocto 版本中添加 Openembedded Layer 提供的任何软件包。请查看 Openembedded Layer 找到您想要的包。之后,您可以通过 local.conf 文件添加任何包。
这里有第三方库
如果页面上没有找到该包,需要自己编译使用适合您平台的编译器并按配方手动添加。
You can add any package which is available by Openembedded Layer in your Yocto release. Please look to Openembedded Layer to find the package you want. After that, you can add any package via your local.conf file.
Here is a third party library
If you don't find the package on the page, you need to compile it on your own using a compiler for your platform and add it manually by recipe.