在需要使用最新代码或者需要进行定制化开发时,则一般需要从源码方式进行安装,在本文中对这种使用方式进行介绍。
和大多数基于 npm 打包的应用一样,按步骤使用如下命令即可完成 node-red 的安装与服务启动。
步骤 1: 下载源码
执行命令: git clone
步骤 2: 安装依赖
执行命令: cd node-red; npm install
步骤 3: 执行构建
执行命令: npm run build
步骤 4: 运行 node-red
执行命令: npm start
下载源码
liumiaocn:~ liumiao$ git clone
cloning into 'node-red'...
remote: enumerating objects: 11, done.
remote: counting objects: 100% (11/11), done.
remote: compressing objects: 100% (10/10), done.
remote: total 48916 (delta 0), reused 4 (delta 0), pack-reused 48905
receiving objects: 100% (48916/48916), 19.04 mib | 262.00 kib/s, done.
resolving deltas: 100% (33405/33405), done.
liumiaocn:~ liumiao$
安装依赖
liumiaocn:~ liumiao$ cd node-red; npm install
...省略
added 1219 packages from 1528 contributors in 109.95s
...省略
liumiaocn:node-red liumiao$ ls
api.md contributing.md readme.md node_modules packages
changelog.md gruntfile.js security.md package-lock.json scripts
code_of_conduct.md license jsdoc.json package.json test
liumiaocn:node-red liumiao$
执行构建
liumiaocn:node-red liumiao$ npm run build
> node-red@1.0.4 build /users/liumiao/node-red
> grunt build
running "clean:build" (clean) task
>> 0 paths cleaned.
running "jsonlint:messages" (jsonlint) task
>> 30 files lint free.
running "jsonlint:keymaps" (jsonlint) task
>> 1 file lint free.
running "concat:build" (concat) task
running "concat:vendor" (concat) task
running "copy:build" (copy) task
created 10 directories, copied 83 files
running "uglify:build" (uglify) task
>> 4 files created 1.68 mb → 654.32 kb
running "sass:build" (sass) task
running "attach威尼斯人最新 copyright:js" (attach威尼斯人最新 copyright) task
attached 威尼斯人最新 copyright to packages/node_modules/@node-red/editor-client/public/red/red.min.js
attached 威尼斯人最新 copyright to packages/node_modules/@node-red/editor-client/public/red/main.min.js
running "attach威尼斯人最新 copyright:css" (attach威尼斯人最新 copyright) task
attached 威尼斯人最新 copyright to packages/node_modules/@node-red/editor-client/public/red/style.min.css
done.
liumiaocn:node-red liumiao$
运行 node-red
liumiaocn:node-red liumiao$ npm start
> node-red@1.0.4 start /users/liumiao/node-red
> node packages/node_modules/node-red/red.js
5 mar 06:30:16 - [info]
welcome to node-red
===================
5 mar 06:30:16 - [info] node-red version: v1.0.4
5 mar 06:30:16 - [info] node.js version: v10.15.3
5 mar 06:30:16 - [info] darwin 19.2.0 x64 le
5 mar 06:30:16 - [info] loading palette nodes
5 mar 06:30:16 - [info] settings file : /users/liumiao/.node-red/settings.js
5 mar 06:30:16 - [info] context store : 'default' [module=memory]
5 mar 06:30:16 - [info] user directory : /users/liumiao/.node-red
5 mar 06:30:16 - [warn] projects disabled : editortheme.projects.enabled=false
5 mar 06:30:16 - [info] flows file : /users/liumiao/.node-red/flows_liumiaocn.json
5 mar 06:30:16 - [info] creating new flow file
5 mar 06:30:16 - [warn]
---------------------------------------------------------------------
your flow credentials file is encrypted using a system-generated key.
if the system-generated key is lost for any reason, your credentials file will not be recoverable, you will have to delete it and re-enter your credentials.
you should set your own key using the 'credentialsecret' option in your settings file. node-red will then re-encrypt your credentials file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
5 mar 06:30:16 - [info] starting flows
5 mar 06:30:16 - [info] started flows
5 mar 06:30:16 - [info] server now running at
结果确认
注:也可以指定端口和其他设定,执行示例如下所示:
liumiaocn:node-red liumiao$ node packages/node_modules/node-red/red.js -p 8080
5 mar 06:32:04 - [info]
welcome to node-red
===================
5 mar 06:32:04 - [info] node-red version: v1.0.4
5 mar 06:32:04 - [info] node.js version: v10.15.3
5 mar 06:32:04 - [info] darwin 19.2.0 x64 le
5 mar 06:32:05 - [info] loading palette nodes
5 mar 06:32:05 - [info] settings file : /users/liumiao/.node-red/settings.js
5 mar 06:32:05 - [info] context store : 'default' [module=memory]
5 mar 06:32:05 - [info] user directory : /users/liumiao/.node-red
5 mar 06:32:05 - [warn] projects disabled : editortheme.projects.enabled=false
...省略
5 mar 06:32:05 - [info] started flows
5 mar 06:32:05 - [info] server now running at
来源:
nodered 澳门人威尼斯3966官网:
noderedgithub:
nodered 英文社区:
nodered 中文社区:https://www.iotschool.com/topics/node81
nodered 中文社区 qq 群:8604461