Node-RED使用指南:2:使用npm进行本地安装

在这里插入图片描述
这篇文章将介绍一下使用npm进行Node-RED本地本地安装的方法。

本地安装

使用npm即可完成安装,执行命令如下:

执行命令:npm install -g --unsafe-perm node-red

  • 本地版本确认
liumiaocn:~ liumiao$ npm -v
6.4.1
liumiaocn:~ liumiao$ node -v
v10.15.3
liumiaocn:~ liumiao$ 
  • 安装Node-Red
liumiaocn:~ liumiao$ npm install -g --unsafe-perm node-red
/Users/liumiao/.nvm/versions/node/v10.15.3/bin/node-red -> /Users/liumiao/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/red.js
/Users/liumiao/.nvm/versions/node/v10.15.3/bin/node-red-pi -> /Users/liumiao/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/bin/node-red-pi

> bcrypt@3.0.6 install /Users/liumiao/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
[bcrypt] Success: "/Users/liumiao/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote
+ node-red@1.0.4
added 334 packages from 340 contributors in 19.568s
liumiaocn:~ liumiao$ 
  • 版本和使用方法确认
liumiaocn:~ liumiao$ node-red -help
Node-RED v1.0.4
Usage: node-red [-v] [-?] [--settings settings.js] [--userDir DIR]
                [--port PORT] [--title TITLE] [--safe] [flows.json]

Options:
  -p, --port     PORT  port to listen on
  -s, --settings FILE  use specified settings file
      --title    TITLE process window title
  -u, --userDir  DIR   use specified user directory
  -v, --verbose        enable verbose output
      --safe           enable safe mode
  -?, --help           show this help

Documentation can be found at http://nodered.org
liumiaocn:~ liumiao$ 

启动服务

使用-p可以指定服务端口,但也可以直接启动,缺省端口为1880

执行命令:node-red -p 8080

liumiaocn:~ liumiao$ node-red -p 8080
5 Mar 06:05:44 - [info] 

Welcome to Node-RED
===================

5 Mar 06:05:44 - [info] Node-RED version: v1.0.4
5 Mar 06:05:44 - [info] Node.js  version: v10.15.3
5 Mar 06:05:44 - [info] Darwin 19.2.0 x64 LE
5 Mar 06:05:44 - [info] Loading palette nodes
5 Mar 06:05:44 - [info] Settings file  : /Users/liumiao/.node-red/settings.js
5 Mar 06:05:44 - [info] Context store  : 'default' [module=memory]
5 Mar 06:05:44 - [info] User directory : /Users/liumiao/.node-red
5 Mar 06:05:44 - [warn] Projects disabled : editorTheme.projects.enabled=false
5 Mar 06:05:44 - [info] Flows file     : /Users/liumiao/.node-red/flows_liumiaocn.json
5 Mar 06:05:44 - [info] Creating new flow file
5 Mar 06:05:44 - [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:05:44 - [info] Starting flows
5 Mar 06:05:44 - [info] Started flows
5 Mar 06:05:44 - [info] Server now running at http://127.0.0.1:8080/

界面确认

出现如下界面,即表明安装和运行已经成功
在这里插入图片描述

淼叔 CSDN认证博客专家 神经网络 TensorFlow NLP
资深架构师,PMP、OCP、CSM、HPE University讲师,EXIN DevOps Professional与DevOps Master认证讲师,曾担任HPE GD China DevOps & Agile Leader,帮助企业级客户提供DevOps咨询培训以及实施指导。熟悉通信和金融领域,有超过十年金融外汇行业的架构设计、开发、维护经验,在十几年的IT从业生涯中拥有了软件开发设计领域接近全生命周期的经验和知识积累,著有企业级DevOps技术与工具实战。
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页