如何在 node-red 容器中预安装模块

How can I preinstall modules in node-red container

我希望在启动时安装我添加的所有模块。我已经检查了我的 .config.json 和 packages.json 文件,但是 运行 在干净的系统(没有 node_modules)上使用 node-red 容器,模块没有显示在模块面板中。 有什么方法可以自动安装这些依赖项吗?例如 运行 "npm install" 在 node-red 服务启动之前? 截至目前,我需要附加到容器,运行 "npm install" 手动并重新启动容器。

您需要构建自己的容器版本。容器的 README.md 中描述了如何执行此操作。

例如像这样的自定义 Dockerfile:

FROM nodered/node-red
RUN npm install node-red-contrib-flightaware

您可以在 package.json and try to push it in the docker itself (I do not have any experience with docker containers), your pallet names should be under dependencies along with the version itself, all of this info is obtainable through npmjs 中添加所有托盘名称。传输文件后,将需要 npm install 来安装所有依赖项。