Prettier, Webstorm, NVM and Linux

I installed Webstorm and wanted Prettier.

I simply installed the Prettier extension and added a File Watcher (as stated in the Doc)

But Prettier refused to run with “node not found” something…

I added this line to my .bashrc file to make sure NVM creates a symlink to the current node version:

export NVM_SYMLINK_CURRENT=true

Then I edited my environment sudo nano /etc/environment and added this folder at the end of my PATH /home/tanguy/.nvm/current/bin (the NVM symlink)

Now Webstorm will launch and Node will be in the PATH so Prettier runs fine.

Oh and I had to add some command line arguments to the Prettier File Watcher on Webstorm because the plugin was not reading my eslintrc.js configuration file.

Netdata in Docker – Monitor my machine

Netdata: https://github.com/netdata/netdata & https://www.netdata.cloud/

is a wonderful tool to monitor a device and trigger alarms

To run it in a second on your local machine, use this docker command

docker run -d --name=netdata -p 19999:19999 -v /proc:/host/proc:ro -v /sys:/host/sys:ro -v /var/run/docker.sock:/var/run/docker.sock:ro --rm --cap-add SYS_PTRACE --security-opt apparmor=unconfined netdata/netdata

Then access the dashboard http://localhost:19999

Systemd – Daemon Hubot (Coffee script)

Here is the content of the file /etc/systemd/system/hubot.service

After creating the file, execute

sudo systemctl daemon-reload && sudo systemctl enable hubot && sudo systemctl start hubot

Replace SLACK_TOKEN below

[Unit]
Description=Hubot
Requires=network.target
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/pi/hubot
User=pi

Restart=always
TimeoutStartSec=10
RestartSec=10

; Configure Hubot environment variables, use quotes around vars with whitespace as shown below.
Environment="HUBOT_SLACK_TOKEN=SLACK_TOKEN"

; which node => /home/pi/.nvm/versions/node/v8.0.0/bin/node
; which coffee (need to install it globally npm install -g coffee-script) => /home/pi/.nvm/versions/node/v8.0.0/bin/coffee
ExecStart=/home/pi/.nvm/versions/node/v8.0.0/bin/node /home/pi/.nvm/versions/node/v8.0.0/bin/coffee /home/pi/hubot/node_modules/hubot/bin/hubot --name pixibot -a slack

[Install]
WantedBy=multi-user.target