4. Installing Node.js for Node-Red

I'd like to use Node-RED. Node-RED is required to have node.js beforehand.

1.       Installing node.js. npm(Node Packaged Module of Node.js package manager) tool is also installed with node.js. 
2.       Installing Node-RED

(Node-REDをインストールする: https://qiita.com/egplnt/items/cf79f49660f2df1c54cc)

1. Installing node.js


In this page, node.js is installed. node.js is brought through nodebrew. So nodebrew is installed here.
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
asciidoctor                go-jira                    msgpuck
asciidoctorj               gutenberg                  ocaml-findlib
avimetaedit                heartbeat                  ocaml-num
bedtools                   htslib                     pdfpc
bench                      iron-functions             pipenv
bzt                        jabba                      postgresql@9.6
cling                      just                       precomp
clingo                     kaitai-struct-compiler     raylib
crc32c                     keystone                   rbenv-chefdk
csvkit                     kibana@5.6                 restic
docker-ls                  kontena                    sc-im
dps8m                      laszip@2                   sceptre
duc                        lgogdownloader             simg2img
e2tools                    libbitcoin-database        singular
elasticsearch@5.6          libxo                      swift-protobuf
envconsul                  logstash@5.6               terraform_landscape
git-appraise               massren                    traefik
glib-openssl               mecab-unidic-extended      ydcv
glslviewer                 mrboom                     zip
==> Updated Formulae
abcm2ps                                  libtrace
abcmidi                                  libuv
abyss                                    libvirt
aces_container                           libvisio
activemq                                 libwebsockets
adplug                                   libwpd
adwaita-icon-theme                       libwpg
afl-fuzz                                 libwps
akamai                                   libxml2
alexjs                                   libxmlsec1
algernon                                 libxslt
allegro                                  lighttpd
allure                                   link-grammar
amazon-ecs-cli                           linkerd
ammonite-repl                            links
angband                                  liquid-dsp
angular-cli                              little-cms2
ansible                                  lldpd
ansible-cmdb                             loc
ansible-lint                             logrotate
antigen                                  logstalgia
apache-arrow                             logstash
apache-geode                             logtalk
apache-opennlp                           lwtools
apibuilder-cli                           lxc
app-engine-go-64                         lynis
app-engine-java                          macosvpn
appscale-tools                           macvim
apr                                      magic-wormhole
apr-util                                 mailutils
arangodb                                 mairix
archivemount                             mame
aria2                                    mapnik
armadillo                                mapserver
artifactory                              mariadb
asciidoc                                 mariadb@10.0
aspcud                                   mariadb@10.1
aspectj                                  mat
assh                                     maven
at-spi2-atk                              mawk
at-spi2-core                             maxima
atk                                      mdds
atlassian-cli                            media-info
ats2-postiats                            mediaconch
aubio                                    megacmd
augeas                                   memcached
aurora-cli                               menhir
aws-elasticbeanstalk                     mercurial
aws-sdk-cpp                              mesalib-glw
aws-shell                                meson
awscli                                   metaproxy
axel                                     metricbeat
azure-cli                                mg
azure-cli@1                              mgba
b2-tools                                 micro
babl                                     micropython
bacula-fd                                midnight-commander
baobab                                   mighttpd2
baresip                                  mikutter
bash-preexec                             mingw-w64
bash-snippets                            minimal-racket
bazel                                    minio
bchunk                                   minio-mc
bear                                     minisign
bento4                                   miniupnpc
bibtexconv                               mitie
binaryen                                 mkclean
bindfs                                   mkdocs
bit                                      mkvalidator
bitcoin                                  mkvtoolnix
bitrise                                  moc
blahtexml                                mockserver
blink1                                   modd
blockhash                                modules
bluepill                                 molecule
bmake                                    monetdb
bnd                                      mongo-c-driver
boost-mpi                                mongodb
botan                                    mongoose
bowtie2                                  monit
brew-gem                                 mono-libgdiplus
bro                                      mosh
bsponmpi                                 mosquitto
btfs                                     mpd
buildifier                               mpv
buku                                     mpw
bwfmetaedit                              multimarkdown
caddy                                    mupdf
caf                                      mupdf-tools
cake                                     mvnvm
calcurse                                 mypy
camlp4                                   mysql
camlp5                                   mysql-sandbox
cargo-completion                         mysql@5.5
carthage                                 mysql@5.6
casperjs                                 nano
cassandra                                nanomsg
ccm                                      nanomsgxx
ceres-solver                             nanopb-generator
certbot                                  natalie
certigo                                  nativefier
cfitsio                                  nats-streaming-server
cfr-decompiler                           ncmpc
chakra                                   ncmpcpp
chapel                                   nco
charm-tools                              ncrack
check                                    ncurses
checkstyle                               ncview
chezscheme                               neatvi
chisel                                   neo4j
chromedriver                             neovim
chronograf                               netcdf
cimg                                     netpbm
citus                                    nettle
ckan                                     nexus
clac                                     nfdump
clhep                                    nghttp2
cli53                                    nginx
clinfo                                   nickle
clojure                                  nifi
clojurescript                            nmh
closure-compiler                         nnn
cmake                                    node
cmark                                    node-build
cnats                                    node@4
cockatrice                               node@6
cockroach                                nomad
cocot                                    noti
codemod                                  notmuch
coffeescript                             nsq
collectd                                 nss
commandbox                               ntl
conan                                    nuget
configen                                 nuttcp
conjure-up                               nvi
consul                                   nvm
consul-template                          ocaml
convmv                                   ocamlbuild
convox                                   ocamlsdl
cookiecutter                             octave
coq                                      ode
corebird                                 offlineimap
couchdb                                  omniorb
cppad                                    ompl
cppcheck                                 opam
cpprestsdk                               open-mpi
credstash                                open-scene-graph
crowdin                                  opencbm
crystal-icr                              opencoarrays
crystal-lang                             opencv
curl                                     opencv@2
cutter                                   openfortivpn
cvs                                      openjazz
cython                                   openjpeg
dar                                      openrtsp
davix                                    opensaml
dbhash                                   openshift-cli
dbus                                     openssh
dbxml                                    openssl
dc3dd                                    openssl@1.1
dcm2niix                                 openvdb
dcmtk                                    openvpn
dcos-cli                                 opusfile
debianutils                              orc
deja-gnu                                 orientdb
dep                                      ortp
dependency-check                         osc
derby                                    osm2pgrouting
dhall-json                               osm2pgsql
diff-pdf                                 osquery
diffoscope                               osrm-backend
digdag                                   overmind
django-completion                        p11-kit
dmd                                      pacapt
dnscrypt-proxy                           packer
dnscrypt-wrapper                         packetbeat
dnsmasq                                  packetq
dnsviz                                   paket
docfx                                    pandoc
docker                                   pandoc-citeproc
docker-completion                        pandoc-crossref
docker-compose                           pango
docker-compose-completion                paperkey
docker-machine                           par2
docker-machine-completion                parallel
docker2aci                               passenger
doctl                                    pazpar2
doitlive                                 pcap_dnsproxy
dos2unix                                 pcb
dovecot                                  pcl
dscanner                                 pdal
dshb                                     pdf2svg
dspdfviewer                              pdfcrack
dssim                                    pdfgrep
dtc                                      pdftoedn
dub                                      pdftoipe
duck                                     pdnsrec
dvm                                      pegtl
e2fsprogs                                percona-server-mongodb
easyrpg-player                           percona-toolkit
efl                                      perl
ejabberd                                 pgpool-ii
elasticsearch                            pgroonga
emscripten                               pgrouting
enigma                                   phoronix-test-suite
erlang                                   physfs
etcd                                     pick
etsh                                     pike
evince                                   pilosa
exact-image                              pioneer
exiftool                                 pioneers
exim                                     pktanon
expat                                    planck
expect                                   plantuml
exploitdb                                pldebugger
eye-d3                                   plzip
faac                                     pmdmini
faad2                                    pngquant
faas-cli                                 poco
fabio                                    polyml
fail2ban                                 pony-stable
fantom                                   ponyc
fastd                                    ponysay
fb-client                                poppler
fd                                       postgis
feedgnuplot                              postgresql
feh                                      postgresql@9.4
ffmpeg                                   postgresql@9.5
ffmpeg@2.8                               pqiv
fibjs                                    pre-commit
fifechan                                 prest
file-roller                              presto
filebeat                                 primesieve
fio                                      proguard
firebase-cli                             prometheus
fish                                     protobuf
flake8                                   protobuf-c
flatbuffers                              protobuf-swift
flawfinder                               psftools
flow                                     psqlodbc
fluent-bit                               pumba
fluid-synth                              pure-ftpd
fn                                       purescript
folly                                    pushpin
fon-flash-cli                            pwntools
fonttools                                py2cairo
fossil                                   py3cairo
freetds                                  pyenv
frugal                                   pyenv-virtualenv
fswatch                                  pygobject3
fuse-emulator                            pypy
fwup                                     pypy3
fzf                                      pyqt
gammu                                    python-markdown
gauge                                    python3
gawk                                     pyvim
gcc@5                                    q
gcviewer                                 qbs
gdcm                                     qca
gdk-pixbuf                               qcli
gdnsd                                    qd
geckodriver                              qemu
gegl                                     qscintilla2
geographiclib                            qt
geoipupdate                              qtfaststart
geoserver                                quantlib
get_iplayer                              quex
getdns                                   rabbitmq
geth                                     radare2
getmail                                  rakudo-star
ghc                                      rancher-cli
ghostscript                              rancid
gibo                                     ratfor
git                                      rbenv-bundler
git-annex                                rdfind
git-cinnabar                             re2
git-cola                                 re2c
git-ftp                                  readosm
git-lfs                                  rebar@3
git-number                               redex
git-quick-stats                          redpen
git-review                               regex-opt
git-town                                 remake
gitbucket                                reminiscence
gitlab-runner                            reop
gjs                                      resty
gjstest                                  ringojs
glade                                    ripgrep
glassfish                                rocksdb
glib                                     rom-tools
glib-networking                          root
glide                                    roswell
globus-toolkit                           rpm
gmic                                     rswift
gmime                                    rtags
gmp                                      rtv
gmsh                                     ruby
gmt                                      ruby@1.8
gmt@4                                    ruby@1.9
gnome-recipes                            ruby@2.0
gnu-time                                 ruby@2.1
gnu-units                                ruby@2.2
gnupg                                    ruby@2.3
gnuplot                                  rust
gnutls                                   s-nail
go                                       s3cmd
go@1.8                                   s6
goad                                     sagittarius-scheme
gobject-introspection                    saltstack
godep                                    sassc
goenv                                    sbcl
gofabric8                                sbt
goffice                                  scala
gomplate                                 scalaenv
goocanvas                                scalapack
goofys                                   scalariform
google-benchmark                         scalastyle
google-java-format                       sccache
googler                                  schismtracker
gopass                                   scipy
govendor                                 scm-manager
gphoto2                                  scons
gpsd                                     screen
gradle                                   sdl2
gradle-completion                        sdl2_gfx
grafana                                  sdl2_image
grails                                   sdl2_mixer
grakn                                    sdl_gfx
graphicsmagick                           selenium-server-standalone
grib-api                                 serd
gromacs                                  sfk
groonga                                  shadowsocks-libev
groovysdk                                shairport-sync
grpc                                     shapelib
gsmartcontrol                            shfmt
gsoap                                    shibboleth-sp
gspell                                   shpotify
gst-editing-services                     siege
gst-libav                                sile
gst-plugins-bad                          silk
gst-plugins-base                         simgrid
gst-plugins-good                         simple-obfs
gst-plugins-ugly                         sip
gst-python                               sjk
gst-rtsp-server                          skinny
gst-validate                             sleuthkit
gstreamer                                smali
gstreamermm                              smartmontools
gtk+3                                    snakemake
gtk-doc                                  snap7
gtk-gnutella                             snapcraft
gtksourceview3                           snort
gucharmap                                solr
gwt                                      solr@5.5
gx                                       sonarqube
gx-go                                    sops
h2o                                      source-to-image
hadoop                                   sourcekitten
hana                                     speedtest-cli
haproxy                                  sphinx-doc
harfbuzz                                 sqldiff
hashcat                                  sqlite
haxe                                     sqlite-analyzer
hercules                                 sqlmap
heroku                                   src
hevea                                    ssdeep
hg-fast-export                           ssh-copy-id
highlight                                sshguard
hive                                     sslh
hivemind                                 sslmate
hopenpgp-tools                           sslyze
html-xml-utils                           stanford-parser
htmlcleaner                              statik
htmldoc                                  stoken
httest                                   stormlib
httpd                                    streamlink
huexpress                                strongswan
hugo                                     stubby
hyperscan                                stunnel
hypre                                    submarine
i2p                                      subnetcalc
ibex                                     subversion
icdiff                                   suil
ice                                      suite-sparse
icoutils                                 sundials
icu4c                                    supersonic
idnits                                   suricata
imagemagick                              svgo
imagemagick@6                            swfmill
imapfilter                               swi-prolog
immortal                                 swift
infer                                    swiftformat
influxdb                                 swiftgen
influxdb@0.8                             swiftlint
inspircd                                 syncthing
iozone                                   sysbench
iperf3                                   sysdig
ipfs                                     taisei
ironcli                                  tarantool
irssi                                    task-spooler
iso-codes                                tectonic
ispc                                     telegraf
isync                                    telegram-cli
itstool                                  teleport
ivykis                                   temporal_tables
jack                                     tenyr
jbig2dec                                 terminal-notifier
jena                                     termius
jenkins                                  terraform
jenkins-lts                              terraform-docs
jfrog-cli-go                             terragrunt
jhipster                                 texapp
jmeter                                   texmath
jmxtrans                                 tfenv
joe                                      tgui
jruby                                    thefuck
json-fortran                             tidy-html5
jsonnet                                  tinc
juju                                     tintin
kawa                                     tippecanoe
kerl                                     tmux
keychain                                 tomcat
khal                                     tomcat@7
kibana                                   tor
kitchen-sync                             tracebox
knot                                     translate-shell
knot-resolver                            ttyd
kobalt                                   txt2tags
kompose                                  typescript
konoha                                   u-boot-tools
kops                                     ucommon
kotlin                                   uftp
kpcli                                    unbound
krb5                                     uncrustify
kubectx                                  upscaledb
kubernetes-cli                           urh
kubernetes-helm                          urlview
kvazaar                                  userspace-rcu
lablgtk                                  vagrant-completion
landscaper                               vala
languagetool                             vapoursynth
lapack                                   varnish
lastpass-cli                             varnish@4
laszip                                   vault
latexila                                 vault-cli
launch                                   vbindiff
lbdb                                     vcdimager
ldc                                      vdirsyncer
lean-cli                                 vert.x
leiningen                                vim
lftp                                     vim@7.4
libass                                   vips
libassuan                                virtualpg
libatomic_ops                            vnu
libbitcoin-blockchain                    vpcs
libbitcoin-node                          vte3
libbitcoin-server                        vtk
libcddb                                  watchexec
libcdio                                  webpack
libcdr                                   wget
libcello                                 when
libconfig                                wildfly-as
libcouchbase                             wine
libcue                                   winetricks
libdivecomputer                          wireguard-tools
libebur128                               wireshark
libetonyek                               wolfssl
libextractor                             wpcli-completion
libfabric                                wtf
libfaketime                              wxmaxima
libfixbuf                                x265
libfreehand                              xalan-c
libfreenect                              xapian
libgosu                                  xclip
libgphoto2                               xctool
libgraphqlparser                         xerces-c
libgsf                                   xmake
libgweather                              xml-security-c
libhdhomerun                             xml-tooling-c
libhttpseverywhere                       xmrig
libical                                  xonsh
liblcf                                   xqilla
libmatio                                 xrootd
libmaxminddb                             xsd
libmtp                                   xtensor
libmxml                                  xxhash
libogg                                   yadm
libopusenc                               yaf
libphonenumber                           yara
libpng                                   yarn
libpq                                    yash
libpqxx                                  yaze-ag
libprotoident                            ykman
libqalculate                             yle-dl
librdkafka                               you-get
libre                                    youtube-dl
librealsense                             yubico-piv-tool
libressl                                 z80dasm
librest                                  zabbix
librsvg                                  zanata-client
librsync                                 zbackup
libsass                                  zenity
libsodium                                zile
libsoup                                  zimg
libspectre                               zint
libspectrum                              zmqpp
libtcod                                  zorba
libtensorflow                            zsh-completions
libtiff                                  zstd
libtorrent-rasterbar                     zurl
==> Renamed Formulae
findbugs -> spotbugs       newsbeuter -> newsboat     thrift@0.90 -> thrift@0.9
==> Deleted Formulae
clasp               htop-osx            libical-glib        solr@5.4
elixirscript        jboss-as            rexster             tcpurify
gringo              jboss-as@5          rexster-console

==> Downloading https://github.com/hokaccha/nodebrew/archive/v0.9.7.tar.gz
==> Downloading from https://codeload.github.com/hokaccha/nodebrew/tar.gz/v0.9.7
######################################################################## 100.0%
==> Caveats
You need to manually run setup_dirs to create directories required by nodebrew:
  /usr/local/opt/nodebrew/bin/nodebrew setup_dirs

Add path:
  export PATH=$HOME/.nodebrew/current/bin:$PATH

To use Homebrew's directories rather than ~/.nodebrew add to your profile:
  export NODEBREW_ROOT=/usr/local/var/nodebrew

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/nodebrew/0.9.7: 8 files, 38.1KB, built in 4 seconds
$ nodebrew -v
nodebrew 0.9.7

Usage:
    nodebrew help                         Show this message
    nodebrew install <version>            Download and install <version> (compile from source)
    nodebrew install-binary <version>     Download and install <version> (binary file)
    nodebrew uninstall <version>          Uninstall <version>
    nodebrew use <version>                Use <version>
    nodebrew list                         List installed versions
    nodebrew ls                           Alias for `list`
    nodebrew ls-remote                    List remote versions
    nodebrew ls-all                       List remote and installed versions
    nodebrew alias <key> <value>          Set alias
    nodebrew unalias <key>                Remove alias
    nodebrew clean <version> | all        Remove source file
    nodebrew selfupdate                   Update nodebrew
    nodebrew migrate-package <version>    Install global NPM packages contained in <version> to current version
    nodebrew exec <version> -- <command>  Execute <command> using specified <version>

Example:
    # install from binary
    nodebrew install-binary v0.10.22

    # use a specific version number
    nodebrew use v0.10.22

    # io.js
    nodebrew install-binary io@v1.0.0
    nodebrew use io@v1.0.0
$ node -v
-bash: node: command not found
$ nodebrew -v
nodebrew 0.9.7

Usage:
    nodebrew help                         Show this message
    nodebrew install <version>            Download and install <version> (compile from source)
    nodebrew install-binary <version>     Download and install <version> (binary file)
    nodebrew uninstall <version>          Uninstall <version>
    nodebrew use <version>                Use <version>
    nodebrew list                         List installed versions
    nodebrew ls                           Alias for `list`
    nodebrew ls-remote                    List remote versions
    nodebrew ls-all                       List remote and installed versions
    nodebrew alias <key> <value>          Set alias
    nodebrew unalias <key>                Remove alias
    nodebrew clean <version> | all        Remove source file
    nodebrew selfupdate                   Update nodebrew
    nodebrew migrate-package <version>    Install global NPM packages contained in <version> to current version
    nodebrew exec <version> -- <command>  Execute <command> using specified <version>

Example:
    # install from binary
    nodebrew install-binary v0.10.22

    # use a specific version number
    nodebrew use v0.10.22

    # io.js
    nodebrew install-binary io@v1.0.0
    nodebrew use io@v1.0.0
$ nodebrew install-binary latest
#latest node.js is installed.
Fetching: https://nodejs.org/dist/v9.2.0/node-v9.2.0-darwin-x64.tar.gz
Warning: Failed to create the file
Warning: /Users/tkurokawa/.nodebrew/src/v9.2.0/node-v9.2.0-darwin-x64.tar.gz:
Warning: No such file or directory

curl: (23) Failed writing body (0 != 941)
download failed: https://nodejs.org/dist/v9.2.0/node-v9.2.0-darwin-x64.tar.gz
$ sudo nodebrew install-binary latest
Password:
Fetching: https://nodejs.org/dist/v9.2.0/node-v9.2.0-darwin-x64.tar.gz
Warning: Failed to create the file
Warning: /Users/tkurokawa/.nodebrew/src/v9.2.0/node-v9.2.0-darwin-x64.tar.gz:
Warning: No such file or directory
                                                                           0.0%
curl: (23) Failed writing body (0 != 941)
download failed: https://nodejs.org/dist/v9.2.0/node-v9.2.0-darwin-x64.tar.gz
$ cd /Users/tkurokawa/.nodebrew/src/v9.2.0/
-bash: cd: /Users/tkurokawa/.nodebrew/src/v9.2.0/: No such file or directory
$ mkdir /Users/tkurokawa/.nodebrew/src/v9.2.0/
mkdir: /Users/tkurokawa/.nodebrew/src: No such file or directory
$ mkdir -R /Users/tkurokawa/.nodebrew/src/v9.2.0/
mkdir: illegal option -- R
$ mkdir -P /Users/tkurokawa/.nodebrew/src/v9.2.0/
mkdir: illegal option -- P
usage: mkdir [-pv] [-m mode] directory ...
$ mkdir -p /Users/tkurokawa/.nodebrew/src/v9.2.0/
#指定したディレクトリをサブディレクトリごと作成する。ツリー状のディレクトリも作成可能(http://itpro.nikkeibp.co.jp/article/COLUMN/20060227/230831/?rt=nocnt)
$ cd /Users/tkurokawa/.nodebrew/src/v9.2.0/
$ cd
$ ls
Applications                                         Movies
Desktop                                                 Music
Documents                                           Pictures
Downloads                                           Public
Dropbox (Aruba Networks)              VIA-VPNAgent
Library                                                   VirtualBox VMs
$ nodebrew install-binary latest
Fetching: https://nodejs.org/dist/v9.2.0/node-v9.2.0-darwin-x64.tar.gz
######################################################################## 100.0%
Installed successfully
$ nodebrew list
v9.2.0

current: none
$ echo %PATH
%PATH
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS
$ ls
Applications                                         Dropbox (Aruba Networks)              Pictures
Desktop                                                 Library                                                   Public
Documents                                           Movies                                                   VIA-VPNAgent
Downloads                                           Music                                                     VirtualBox VMs
$ ls -a
.                                                               .cups                                                      Dropbox (Aruba Networks)
..                                                             .dropbox                                               Library
.CFUserTextEncoding                        .nodebrew                                            Movies
.DS_Store                                             .ssh                                                         Music
.Trash                                                    .viminfo                                 Pictures
.atom                                                     Applications                                         Public
.bash_history                                       Desktop                                                 VIA-VPNAgent
.bash_sessions                                     Documents                                           VirtualBox VMs
.config                                                   Downloads

$ cd .nodebrew/
$ ls
iojs          node       src

On top of latest version, other version can be installed. v6 get the latest 6.x version.
[~/.nodebrew/node/v9.2.0]$nodebrew install-binary v6
Fetching: https://nodejs.org/dist/v6.12.3/node-v6.12.3-darwin-x64.tar.gz
######################################################################## 100.0%

Installed successfully

Listing several versions.
[~/.nodebrew/node/v6.12.3/bin]$nodebrew ls
v6.12.3
v9.2.0

Listing several versions in the repository on the Internet.
[~/.nodebrew/node/v6.12.3/bin]$nodebrew ls-all
remote:

v0.0.1    v0.0.2    v0.0.3    v0.0.4    v0.0.5    v0.0.6   

v0.1.0    v0.1.1    v0.1.2    v0.1.3    v0.1.4    v0.1.5    v0.1.6    v0.1.7
v0.1.8    v0.1.9    v0.1.10   v0.1.11   v0.1.12   v0.1.13   v0.1.14   v0.1.15
v0.1.16   v0.1.17   v0.1.18   v0.1.19   v0.1.20   v0.1.21   v0.1.22   v0.1.23
v0.1.24   v0.1.25   v0.1.26   v0.1.27   v0.1.28   v0.1.29   v0.1.30   v0.1.31

Switching version with "nodebrew use version" command.
Setting the $PATH.
[~]$nodebrew use v6.12.3
use v6.12.3
[~]$node -v
-bash: node: command not found
[~]$echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bash_profile
[~]$node -v
-bash: node: command not found
[~]$source ~/.bash_profile
[~]$node -v
v6.12.3
[~]$nodebrew use v9.2.0
use v9.2.0
[~]$node -v
v9.2.0

trying interactive mode of node.js.
[~/.nodebrew/node/v6.12.3/bin]$./node
> console.log("Hello World!");
Hello World!
undefined
> .exit
[~/.nodebrew/node/v6.12.3/bin]$

2. Installing Node-RED

Selecting the node.js version.
 [~]$nodebrew use v6.12.3
use v6.12.3
[~]$nodebrew ls
v6.12.3
v9.2.0
current: v6.12.3
[~]$node -v

v6.12.3

Installing node-red.
[~]$sudo npm install -g --unsafe-perm node-red


Starting node-red. Node-red stats at http://127.0.0.1:1880/.
[~]$node-red 
Welcome to Node-RED
===================

16 Jan 17:07:09 - [info] Node-RED version: v0.17.5
16 Jan 17:07:09 - [info] Node.js  version: v6.12.3
16 Jan 17:07:09 - [info] Darwin 16.7.0 x64 LE
16 Jan 17:07:10 - [info] Loading palette nodes
16 Jan 17:07:10 - [warn] ------------------------------------------------------
16 Jan 17:07:10 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
16 Jan 17:07:10 - [warn] ------------------------------------------------------
16 Jan 17:07:10 - [info] Settings file  : /Users/tkurokawa/.node-red/settings.js
16 Jan 17:07:10 - [info] User directory : /Users/tkurokawa/.node-red
16 Jan 17:07:10 - [info] Flows file     : /Users/tkurokawa/.node-red/flows_Takaharus-MacBook-Pro.local.json
16 Jan 17:07:10 - [info] Server now running at http://127.0.0.1:1880/
16 Jan 17:07:10 - [info] Starting flows
16 Jan 17:07:10 - [info] [e-mail in:80a466a9.3f34c8] Checking IMAP for new messages
16 Jan 17:07:10 - [info] Started flows 


- Accessing 127.0.0.1:1880/.
- Setting email rule with title triggering "test" keyword matching.
- Object shows "payload" of email content is "hello" and "topic" of email title is test.

top page









switch node rule





















- Starting node-red in background
- standard output and error options is "command > log-file 2>$1".
- "tail -f" shows logs realtime.
[~]$node-red > node-red.log 2>&1 &
[1] 2483
[~]$jobs
[1]+  Running                 node-red > node-red.log 2>&1 &
[~]$ps -a
  PID TTY           TIME CMD
  586 ttys000    0:00.03 login -pf tkurokawa
  588 ttys000    0:00.01 -bash
  632 ttys001    0:00.02 login -pf tkurokawa
  634 ttys001    0:00.01 -bash
  651 ttys002    0:00.02 login -pf tkurokawa
  654 ttys002    0:00.03 -bash
 2483 ttys002    0:00.66 node /Users/tkurokawa/.nodebrew/current/bin/node-red
 2484 ttys002    0:00.15 npm 
 2485 ttys002    0:00.00 ps -a

[~]$tail -f node-red.log
16 Jan 17:19:23 - [info] [e-mail in:80a466a9.3f34c8] Checking IMAP for new messages
16 Jan 17:19:31 - [info] [e-mail:emial-namegmail.com] Message sent: 250 2.0.0 OK 1516090771 129sm838982ity.34 - gsmtp <-- sending email to gmail.
16 Jan 17:19:33 - [info] [e-mail in:80a466a9.3f34c8] Checking IMAP for new messages

16 Jan 17:19:43 - [info] [e-mail in:80a466a9.3f34c8] Checking IMAP for new messages

[~]$kill <PID>
#to finish the node-red

Memo:
- It kept generating logs and crashed eventually even though the version may not have nothing to do with.
- The email checks Japanese email contes and seems to hit the language related issue. Google shows some hits.
Error: Encoding not recognized: 'ISO-2022-JP' (searched as: 'iso2022jp')
    at Object.getCodec (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/iconv-lite/lib/index.js:102:23)
    at Object.getDecoder (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/iconv-lite/lib/index.js:118:23)
    at Object.decode (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/iconv-lite/lib/index.js:36:25)
    at convertIconvLite (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/encoding/lib/encoding.js:91:26)
    at convert (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/encoding/lib/encoding.js:51:22)
    at Object.decodeBase64 (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/mimelib/lib/mimelib.js:257:16)
    at Object.decodeMimeWord (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/mimelib/lib/mimelib.js:330:25)
    at Object.module.exports.decodeMimeWord (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/mimelib/lib/mimelib.js:64:41)
    at MailParser.<anonymous> (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/mailparser/lib/mailparser.js:1395:24)
    at RegExp.[Symbol.replace] (native)
Error: Encoding not recognized: 'ISO-2022-JP' (searched as: 'iso2022jp')
    at Object.getCodec (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/iconv-lite/lib/index.js:102:23)
    at Object.getDecoder (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/iconv-lite/lib/index.js:118:23)
    at Object.decode (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/iconv-lite/lib/index.js:36:25)
    at convertIconvLite (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/encoding/lib/encoding.js:91:26)
    at convert (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/encoding/lib/encoding.js:51:22)
    at Object.decodeBase64 (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/mimelib/lib/mimelib.js:257:16)
    at Object.decodeMimeWord (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/mimelib/lib/mimelib.js:330:25)
    at Object.module.exports.decodeMimeWord (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/mimelib/lib/mimelib.js:64:41)
    at MailParser.<anonymous> (/Users/tkurokawa/.nodebrew/node/v6.12.3/lib/node_modules/node-red/node_modules/mailparser/lib/mailparser.js:1395:24)

    at RegExp.[Symbol.replace] (native)

Reference:
Node-RED Getting Started > Installation:
https://nodered.org/docs/getting-started/installation
Node-REDをインストールする: 
https://qiita.com/egplnt/items/cf79f49660f2df1c54cc)
画面からデータフローを定義できるプロダクトってどんなのがあるの?: 
https://qiita.com/kimutansk/items/df9c601d2d21c20c79f7
Macでnode.jsをインストール、npmコマンドも使用可にする【2017.8月最新版】:
https://qiita.com/non0311/items/664cf74d9ff4bad9cf46
Node.jsをMacにインストール!(Homebrew→Nodebrew→Node.js順にインストール):
http://mmorley.hatenablog.com/entry/2016/11/22/233034

コメント

このブログの人気の投稿

ATOM package install

2. Editting prompt