How to install node-red from scratch

os install
and logged in a user
and i am now in terminal window which talks about using root

do i just run this command as is or do i need to put the sudo in front?

Do not put sudo in front of it.

The instructions don't mention sudo.

If you needed to use sudo the docs would tell you.

then why has this failed

image

garrath

That suggests you have run npm with sudo previously and it has screwed up permissions.
Run the command it suggests:

sudo chown -R ........

Then rerun the script.

this is a new install
nothing has been done other than
installed zorin 15 core
signed in
run the software updated checker (found no updates)
started terminal session
then ran the bash command

this is the result
"
user@zorin15core:~$ bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

This script will remove versions of Node.js prior to version 7.x, and Node-RED and
if necessary replace them with Node.js 10.x LTS (dubnium) and the latest Node-RED from Npm.

It also moves any Node-RED nodes that are globally installed into your user
~/.node-red/node_modules directory, and adds them to your package.json, so that
you can manage them with the palette manager.

It also tries to run 'npm rebuild' to refresh any extra nodes you have installed
that may have a native binary component. While this normally works ok, you need
to check that it succeeds for your combination of installed nodes.

To do all this it runs commands as root - please satisfy yourself that this will
not damage your Pi, or otherwise compromise your configuration.
If in doubt please backup your SD card first.

Are you really sure you want to do this ? [y/N] ? y

Would you like to install the Pi-specific nodes ? [y/N] ?

Running Node-RED update for user user at /home/user on zorin

[sudo] password for user:

This can take 20-30 minutes on the slower Pi versions - please wait.

Stop Node-RED :heavy_check_mark:
Remove old version of Node-RED :heavy_check_mark:
Remove old version of Node.js :heavy_check_mark:
Install Node.js LTS :heavy_check_mark: Node v12.16.1 Npm 6.14.2
Clean npm cache :heavy_check_mark:
Install Node-RED core
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ npm update check failed โ”‚
โ”‚ Try running with sudo or get access โ”‚
โ”‚ to the local update config store via โ”‚
โ”‚ sudo chown -R USER:(id -gn $USER) /home/user/.config โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Install Node-RED core :heavy_check_mark: 1.0.4
Any errors will be logged to /var/log/nodered-install.log
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ npm update check failed โ”‚
โ”‚ Try running with sudo or get access โ”‚
โ”‚ to the local update config store via โ”‚
โ”‚ sudo chown -R USER:(id -gn $USER) /home/user/.config โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Move global nodes to local -
Install extra Pi nodes -
Npm rebuild existing nodes -
Add shortcut commands :heavy_check_mark:
Update systemd script :heavy_check_mark:

All done.
You can now start Node-RED with the command node-red-start
or using the icon under Menu / Programming / Node-RED
Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started Sun 8 Mar 14:40:55 GMT 2020 - Finished Sun 8 Mar 14:42:07 GMT 2020

user@zorin15core:~ ^C user@zorin15core:~
"

Ok, so aside from the npm update message, the output ends with:

Have you tried any of that?

yes its up and running
but I am still left with the same issue I can't install my nodes


2020-03-08T15:04:07.984Z Install : node-red-contrib-smartthings 0.0.20

2020-03-08T15:04:08.046Z npm install --no-audit --no-update-notifier --save --save-prefix="~" --production node-red-contrib-smartthings@0.0.20
2020-03-08T15:04:08.959Z [err] npm
2020-03-08T15:04:08.960Z [err] ERR! code ENOENT
2020-03-08T15:04:08.960Z [err] npm ERR! syscall spawn git
2020-03-08T15:04:08.960Z [err] npm ERR! path git
2020-03-08T15:04:08.960Z [err] npm ERR! errno ENOENT
2020-03-08T15:04:08.960Z [err] npm
2020-03-08T15:04:08.960Z [err] ERR! enoent Error while executing:
2020-03-08T15:04:08.960Z [err] npm ERR!
2020-03-08T15:04:08.960Z [err] enoent undefined ls-remote -h -t https://github.com/otaviojr/smartthings-node.git
2020-03-08T15:04:08.960Z [err] npm ERR! enoent
2020-03-08T15:04:08.960Z [err]
2020-03-08T15:04:08.960Z [err] npm ERR! enoent
2020-03-08T15:04:08.960Z [err]
2020-03-08T15:04:08.960Z [err] npm ERR! enoent spawn git ENOENT
2020-03-08T15:04:08.960Z [err] npm
2020-03-08T15:04:08.960Z [err] ERR! enoent This is related to npm not being able to find a file.
2020-03-08T15:04:08.960Z [err] npm ERR!
2020-03-08T15:04:08.961Z [err] enoent
2020-03-08T15:04:08.967Z [err]
2020-03-08T15:04:08.967Z [err] npm ERR! A complete log of this run can be found in:
2020-03-08T15:04:08.967Z [err] npm
2020-03-08T15:04:08.967Z [err] ERR! /home/user/.npm/_logs/2020-03-08T15_04_08_961Z-debug.log
2020-03-08T15:04:08.970Z rc=1

and what are the error on a new install all about?

This thread was about how to install Node-RED. If you have issues installing a particular node, that is a separate matter.

I don't know why you hit that particular warning about npm update - I have never seen it before. All I can suggest is you do what it says and run:

sudo chown -R USER:(id -gn $USER) /home/user/.config 

Regarding the install error, is it only that particular module you can't install? Have you tried installing something else?

sorry i am stuggling to understand this is all node-red to me and setting it up
I dont understand the sudo command, do I just run "sudo chown -R USER:(id -gn $USER) /home/user/.config" from the terminal screen
or is it telling me to login as administrator somehow or is it saying run the original command with sudo in front off it (which is how I would read it)?

why is my setup any different than the test you did?

I am running it on a hyper-v virtual but I see no reason that should make an difference!

Run the command exactly as written in a regular terminal.

sudo chown -R USER:(id -gn $USER) /home/user/.config

ok done

now what do i do (sorry)

Running that command should have fixed up the issue with npm. It doesn't have any bearing on running Node-RED. As you've shown, you can already run node-red.

So its up to you what to do next.

I've had a quick look at the smartthings node you are trying to install. One of its dependencies requires the git command line tool to be installed. The error you are getting means you don't have git installed.

You can install git by running the following in a terminal exactly as written:

sudo apt-get install git

Once that has completed, try installing the smartthings node in Node-RED again.

R thank you so much
that has fixed it !!

so sorry its been so difficult I dont know what git is or where it came from or how you found it

but it has now loaded and appears to be working

thank you so much

I do like the system but find the installation and updates very confusing

Nodes should not normally need git in order to install - the fact that this one does is an oddity and down to the way the author has decided to package his node. I'll ask the author to see what he says.

1 Like

great let me know

3 posts were split to a new topic: How to include git in a Node-RED Docker Instance

Issue raised here - Loading dependency from github ยท Issue #27 ยท otaviojr/node-red-contrib-smartthings ยท GitHub

1 Like