【问题标题】:cant install new nods in embed node-red无法在嵌入 node-red 中安装新节点
【发布时间】:2021-03-07 11:23:06
【问题描述】:

嵌入到现有应用中

https://nodered.org/docs/user-guide/runtime/embedding

所以当转到管理调色板并安装任何新节点时,我在编辑器中看到错误

安装失败:node-red-contrib-ui-svg

找不到模块'node-red-contrib-ui-svg

查看日志了解更多信息

还有这个完整的日志:

2021-03-07T10:26:01.901Z Install : node-red-contrib-ui-svg 2.2.1

2021-03-07T10:26:01.910Z npm.cmd install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-contrib-ui-svg@2.2.1
2021-03-07T10:26:10.448Z [err] npm notice
2021-03-07T10:26:10.449Z [err]  created a lockfile as package-lock.json. You should commit this file.
2021-03-07T10:26:10.450Z [out] + node-red-contrib-ui-svg@2.2.1
2021-03-07T10:26:10.450Z [out] added 29 packages from 28 contributors in 6.044s
2021-03-07T10:26:10.488Z rc=0

但是在编辑器中检查新安装的节点时无法显示其 . 并在重新启动 node-red 后相同的问题 这是我的 nodejs 应用程序:

var http = require('http');
var express = require("express");
var RED = require("node-red");


// Create an Express app
var app = express();

// Add a simple route for static content served from 'public'
app.use("/", express.static("public"));


// Create a server
var server = http.createServer(app);


// Create the settings object - see default settings.js file for other options
var settings = {
    httpAdminRoot: "/red1",
    httpNodeRoot: "/api",
    userDir: "./hhh",
    functionGlobalContext: {} // enables global context
};



// Initialise the runtime with a server and settings

RED.init(server, settings);


// Serve the editor UI from /red
app.use(settings.httpAdminRoot, RED.httpAdmin);


// Serve the http nodes UI from /api
app.use(settings.httpNodeRoot, RED.httpNode);


server.listen(8005);


// Start the runtime
RED.start();
node-red : v1.2.9-git
npm -v : 6.14.4
node -v : v12.16.3

【问题讨论】:

  • 日志输出表明安装成功。 Edit 显示您如何设置嵌入式实例以及将 userDir 之类的东西放在哪里的问题@
  • 如果您在.hhh 下查看,SVG 节点是否存在?还有你用的是什么版本的 Node-RED、nodejs 和 npm?
  • 是的,找到了,路径:.hhh\node_modules\node-red-contrib-ui-svg。和我的版本 node-red : v1.2.9-git, npm -v : 6.14.4, node -v : v12.16.3,
  • 这是你吗? discourse.nodered.org/t/… 如果是这样,请继续在话语上工作,在这里也发布它只会分散精力。
  • 我在这里是因为没有收到论坛的回复。好的,感谢重播

标签: node-red


【解决方案1】:

感谢 hardillb 解决了

请运行以下 2 个测试: 在设置对象中使用 userDir 的完整路径:D:\Project\node-red-template embedded\hhh

【讨论】:

    猜你喜欢
    • 2021-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-16
    相关资源
    最近更新 更多