meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
start:node-red_on_bbb [2019/01/08 11:16] admin |
start:node-red_on_bbb [2019/01/08 11:19] (current) admin |
||
---|---|---|---|
Line 5: | Line 5: | ||
There are no node or npm packages needed from Debian repos, so first remove leftover nodejs stuff and apt installed packages from the [[https://stackoverflow.com/questions/9283472/command-to-remove-all-npm-modules-globally#9283646|Linux directories]]: | There are no node or npm packages needed from Debian repos, so first remove leftover nodejs stuff and apt installed packages from the [[https://stackoverflow.com/questions/9283472/command-to-remove-all-npm-modules-globally#9283646|Linux directories]]: | ||
<Code:bash> | <Code:bash> | ||
- | # su | + | guest:~$ su |
- | # npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm | + | ~# npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm |
- | # apt-get remove npm nodejs | + | ~# apt-get remove npm nodejs |
</Code> | </Code> | ||
Be sure to install needed packages for building[[https://www.linuxuprising.com/2018/04/how-to-install-and-configure-nodejs-and.html|nodejs]]: | Be sure to install needed packages for building[[https://www.linuxuprising.com/2018/04/how-to-install-and-configure-nodejs-and.html|nodejs]]: | ||
<Code:bash> | <Code:bash> | ||
- | apt-get install curl build-essential | + | ~# apt-get install curl build-essential |
</Code> | </Code> | ||
Then add deb.nodesource.com to apt repository and install nodejs 8: | Then add deb.nodesource.com to apt repository and install nodejs 8: | ||
<Code:bash> | <Code:bash> | ||
- | # curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - | + | ~# curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - |
- | # apt-get install nodejs | + | ~# apt-get install nodejs |
</Code> | </Code> | ||
Line 24: | Line 24: | ||
Login as user who later runs nodejs and download the nosudo script: | Login as user who later runs nodejs and download the nosudo script: | ||
<Code:bash> | <Code:bash> | ||
- | # cd | + | guest:~$ cd |
- | # wget https://raw.githubusercontent.com/glenpike/npm-g_nosudo/master/npm-g-nosudo.sh | + | guest:~$ wget https://raw.githubusercontent.com/glenpike/npm-g_nosudo/master/npm-g-nosudo.sh |
</Code> | </Code> | ||
Execute script and .bashrc: | Execute script and .bashrc: | ||
<Code:bash> | <Code:bash> | ||
- | # chmod +x npm-g-nosudo.sh | + | guest:~$ chmod +x npm-g-nosudo.sh |
- | # ./npm-g-nosudo.sh | + | guest:~$ ./npm-g-nosudo.sh |
- | # source ~/.bashrc | + | guest:~$ source ~/.bashrc |
</Code> | </Code> | ||
Now you are able to install needed npm packages as user globally: | Now you are able to install needed npm packages as user globally: | ||
<Code:bash> | <Code:bash> | ||
- | # npm install -g <some package> | + | guest:~$ npm install -g <some package> |
</Code> | </Code> | ||
Line 42: | Line 42: | ||
The "Node-RED graphical event wiring tool" called node-red must be installed for having the web based wiring tool on bbb:1880 as far as some node-red nodes for accessing the GPIO of the beagle bone black: | The "Node-RED graphical event wiring tool" called node-red must be installed for having the web based wiring tool on bbb:1880 as far as some node-red nodes for accessing the GPIO of the beagle bone black: | ||
<Code:bash> | <Code:bash> | ||
- | # npm i node-red -g | + | guest:~$ npm i node-red -g |
- | # npm i beaglebone-io johnny-five node-red-contrib-gpio -g | + | guest:~$ npm i beaglebone-io johnny-five node-red-contrib-gpio -g |
</Code> | </Code> | ||
Integrate node-red into systemd by creating a /lib/systemd/system/nodered.service with following content: | Integrate node-red into systemd by creating a /lib/systemd/system/nodered.service with following content: | ||
<Code> | <Code> | ||
- | # systemd service file to start Node-RED | + | ~# systemd service file to start Node-RED |
[Unit] | [Unit] | ||
Description=Node-RED graphical event wiring tool. | Description=Node-RED graphical event wiring tool. | ||
Line 71: | Line 71: | ||
Enable service: | Enable service: | ||
<Code:bash> | <Code:bash> | ||
- | # systemctl daemon-reload | + | ~# systemctl daemon-reload |
- | # systemctl enable nodered.service | + | ~# systemctl enable nodered.service |
</Code> | </Code> | ||
Show loggings of node-red: | Show loggings of node-red: | ||
<Code:bash> | <Code:bash> | ||
- | # journalctl -fu nodered.service -b | + | ~# journalctl -fu nodered.service -b |
</Code> | </Code> | ||