Installing NodeRed on emonSD-30Oct18

I’ve installed the new SD (16gb). Have activated SSH. Via PuTTy have followed instal for NodeRed

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

but am coming up with second error which I don’t know how to resolve.

First error required me to manually run:

sudo dpkg --configure -a

Did that and am now coming up with error

“E: The package nodejs needs to be reinstalled, but I can’t find an archive for it.”
nodered install 4.txt (8.2 KB)

transcript uploaded.

Any help appreciated as I’m now missing updates to my inputs

Regards
John

Have you tried running sudo apt-get install -f ?

Bill,

No I haven’t. Not up with this at all. what does this do?

John

Fixes “broken” packages.

After you run that, run sudo dpkg --configure -a again

Ref: E: dpkg was interrupted... run 'sudo dpkg --configure -a' - Ask Ubuntu

okay great will try this now.

comes up as follows:
pi@emonpi:/var/log $ sudo apt-get install -f
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: The package nodejs needs to be reinstalled, but I can’t find an archive for it.
pi@emonpi:/var/log $ sudo dpkg --configure -a
pi@emonpi:/var/log $

restarting node red install again

comes up with same error “FAiled to install node.js - exit”

Have you tried sudo apt-get install nodejs ?

Again, no but I’ll do it first thing tomorrow morning. Off out now. Thanks.
John

I’ve just fired up a stock emonSD-30Oct18 image and run

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

I had to answer a couple of questions and accept a warning that it would overwrite any other nodered currently installed, obviously not an issue! It installed fine.

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

  Stop Node-RED                       ✔
  Remove old version of Node-RED      ✔
  Remove old version of Node.js       ✔
  Install Node.js LTS                 ✔   Node v10.14.0   Npm 6.4.1
  Clean npm cache                     ✔
  Install Node-RED core               ✔   0.19.5 
  Move global nodes to local          -
  Install extra Pi nodes              -
  Npm rebuild existing nodes          -
  Add shortcut commands               ✔
  Update systemd script               ✔
                                           

Any errors will be logged to   /var/log/nodered-install.log

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

Did you copy and past the command directly from the nodred install page: Redirecting…

There were some funny html characters in the command in your post above, I thought this was just a formatting error which I corrected. Best double check. In the future please try and put code in tags e.g. ` ` for single lines or ``` ``` for a multiline code block. This makes code blocks much easier to read

Update:

It seems by default the script does not make noderes start on bootup. To start node-red manually after a reboot run:

node-red start

To enable node-red start automatically on boot each time run:

sudo systemctl enable nodered.service

1 Like

Perhaps add to documentation somewhere?

Bill
I ran install nodejs. Is this the output that I should be expecting?

emonSD-30Oct18
pi@emonpi:~ $ sudo apt-get install nodejs
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: The package nodejs needs to be reinstalled, but I can’t find an archive for it.
pi@emonpi:~ $

“E: The package nodejs needs to be reinstalled, but I can’t find an archive for it.”
is this an error.

.node-red directory contains following

pi@emonpi:~ $ cd .node-red
pi@emonpi:~/.node-red $ ls -all
total 92
drwxr-xr-x 4 pi pi 4096 Aug 16 13:41 .
drwxr-xr-x 20 pi pi 4096 Nov 29 15:30 …
-rw-r–r-- 1 pi pi 14596 Aug 16 13:41 .config.json
-rw-r–r-- 1 pi pi 14538 Aug 15 16:17 .config.json.backup
-rw-r–r-- 1 pi pi 212 Aug 15 16:19 flows_emonpi_cred.json
-rw-r–r-- 1 pi pi 208 Aug 15 16:18 .flows_emonpi_cred.json.backup
-rw-r–r-- 1 pi pi 5723 Aug 15 16:19 flows_emonpi.json
-rw-r–r-- 1 pi pi 5708 Aug 15 16:18 .flows_emonpi.json.backup
drwxr-xr-x 3 pi pi 4096 Aug 15 13:32 lib
drwxr-xr-x 7 pi pi 4096 Aug 16 15:29 node_modules
-rw-r–r-- 1 pi pi 99 Aug 15 13:32 package.json
-rw-r–r-- 1 pi pi 715 Aug 16 13:41 .sessions.json
-rw-r–r-- 1 pi pi 11120 Aug 15 16:16 settings.js
pi@emonpi:~/.node-red $

It would be better to stick to the script if possible, and let’s try and work out why that isn’t working.
Have you tried it again this morning, noting Glyn’s comments above?

Paul,

Following your comment I did a reboot, started PuTTy and ran:
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

answered 2 questions then this output

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:
Update Node.js LTS ✘ Failed to install Node.js - Exit
Clean npm cache
Install Node-RED core
Move global nodes to local
Install extra Pi nodes
Npm rebuild existing nodes
Add shortcut commands
Update systemd script

Any errors will be logged to /var/log/nodered-install.log

pi@emonpi:~ $

output log file is available but is same as previously posted. do you want me to load the new log?

Could you try updating your package lists;
sudo apt-get update
and update the installed packages;
sudo apt-get dist-upgrade

Reboot,and then try the script again, and it it errors, paste your error log, with three backticks on the line above the code, and three on the lie below it.

```
Paste your code here
```
is the then rendered in the forum as

Paste your code here

As it’s much easier to read than having to download a .txt file and editor!

emonSD-30Oct18
pi@emonpi:~ $ sudo apt-get update
Hit:1 http://archive.raspberrypi.org/debian stretch InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Hit:3 https://deb.nodesource.com/node_10.x stretch InRelease
Reading package lists... Done
pi@emonpi:~ $ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package nodejs needs to be reinstalled, but I can't find an archive for it.
pi@emonpi:~ $

is that last line an error. please let me know before I continue

It certainly looks like that is your problem - it can’t locate the source files for nodeJS.

Could your system source list files have become corrupted, so that it cannot locate the nodeJS package?
You could try deleting them, and re-installing them.

sudo rm /var/lib/apt/lists/* -vf

and then add them back;

sudo apt-get update

I found this answer from here by searching on

The package nodejs needs to be reinstalled, but I can’t find an archive for it

might work.

If not I’d install ‘npm’ (if not installed) and then ‘n’ and then nodejs. n is an excellent package manager. I have had to switch down a NodeJS version to get some BLE packages to work. I can give you more info if necessary.

Might seem an odd question, but what Pi are you using?

I don’t think it’s a corrupted package Brian. Because the node-RED script is confirming that it has successfully removed it from the system, before trying to find the source URL to re install it.

as follows from admin page

Server Information
Emoncms Version low-write 9.9.5
Modules Administration : App v1.2.0 : Backup v1.1.5 : EmonHub Config v1.0.0 : Dashboard v1.3.1 : Device v1.2.0 : EventProcesses : Feed : Graph v1.2.1 : Input : Postprocess v1.0.0 : CoreProcess : Schedule : Network Setup v1.0.0 : sync : Time : User : Visualisation : WiFi v1.3.0
Git URL GitHub - emoncms/emoncms: Web-app for processing, logging and visualising energy, temperature and other environmental data
Git Branch * stable
Buffer loading…
Writer Daemon is running with sleep 60s
Server OS Linux 4.14.71-v7+
Host emonpi emonpi (192.168.1.121)
Date 2018-11-30 11:01:49 UTC
Uptime 11:01:49 up 1:11, 0 users, load average: 1.60, 1.71, 1.76
HTTP Server Apache/2.4.25 (Raspbian) HTTP/1.1 CGI/1.1 80
MySQL Version 5.5.5-10.1.23-MariaDB-9+deb9u1
Host 127.0.0.1 (127.0.0.1)
Date 2018-11-30 11:01:49 (UTC 00:00‌​)
Stats Uptime: 4265 Threads: 3 Questions: 16944 Slow queries: 0 Opens: 23 Flush tables: 1 Open tables: 17 Queries per second avg: 3.972
Redis Version 3.2.6
Host localhost:6379 (127.0.0.1)
Size 221 keys (869.52K)
Uptime 0 days
MQTT Server Version Mosquitto 1.4.10
Host localhost:1883 (127.0.0.1)
Pi Model Raspberry Pi 3 Model B Rev 1.2 - 1 GB (Sony UK)
SoC Broadcom BCM2835
Serial num. 2A7E72D2
Temperature CPU: 52.62°C - GPU: 53.2’C
Release emonSD-30Oct18
File-system Current: read-write - Set root file-system temporarily to read-write, (default read-only)
Memory RAM Used: 17.48% Total: 976.74 MB Used: 170.69 MB Free: 806.05 MB
Swap Used: 0.00% Total: 100 MB Used: 0 B Free: 100 MB
Disk Mount Stats
/ Used: 39.33% Total: 3.81 GB Used: 1.5 GB Free: 2.13 GB
/boot Used: 51.69% Total: 42.52 MB Used: 21.98 MB Free: 20.54 MB
/home/pi/data Used: 4.09% Total: 10.32 GB Used: 431.92 MB Free: 9.37 GB
PHP Version 7.0.30-0+deb9u1 (Zend Version 3.0.0)
Modules apache2handler : calendar v7.0.30-0+deb9u1 : Core v7.0.30-0+deb9u1 : ctype v7.0.30-0+deb9u1 : curl v7.0.30-0+deb9u1 : date v7.0.30-0+deb9u1 : dom v20031129 : exif v7.0.30-0+deb9u1 : fileinfo v1.0.5 : filter v7.0.30-0+deb9u1 : ftp v7.0.30-0+deb9u1 : gd v7.0.30-0+deb9u1 : gettext v7.0.30-0+deb9u1 : hash v1.0 : iconv v7.0.30-0+deb9u1 : igbinary v2.0.1 : json v1.4.0 : libxml v7.0.30-0+deb9u1 : mbstring v7.0.30-0+deb9u1 : mcrypt v7.0.30-0+deb9u1 : mosquitto v0.4.0 : mysqli v7.0.30-0+deb9u1 : mysqlnd vmysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $ : openssl v7.0.30-0+deb9u1 : pcre v7.0.30-0+deb9u1 : PDO v7.0.30-0+deb9u1 : pdo_mysql v7.0.30-0+deb9u1 : Phar v2.0.2 : posix v7.0.30-0+deb9u1 : readline v7.0.30-0+deb9u1 : redis v4.1.1 : Reflection v7.0.30-0+deb9u1 : session v7.0.30-0+deb9u1 : shmop v7.0.30-0+deb9u1 : SimpleXML v7.0.30-0+deb9u1 : sockets v7.0.30-0+deb9u1 : SPL v7.0.30-0+deb9u1 : standard v7.0.30-0+deb9u1 : sysvmsg v7.0.30-0+deb9u1 : sysvsem v7.0.30-0+deb9u1 : sysvshm v7.0.30-0+deb9u1 : tokenizer v7.0.30-0+deb9u1 : wddx v7.0.30-0+deb9u1 : xml v7.0.30-0+deb9u1 : xmlreader v7.0.30-0+deb9u1 : xmlwriter v7.0.30-0+deb9u1 : xsl v7.0.30-0+deb9u1 : Zend OPcache v7.0.30-0+deb9u1 : zlib v7.0.30-0+deb9u1
Client Information
HTTP Browser Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Screen Resolution 1920 x 1080
Window Size 1903 x 948

I think that is a default answer from the script rather than an actual confirmation as it keep repeating that answer despite not reinstalling.

@JohnSchols try


[edit] sorry should be
```
sudo dpkg --purge --force-all nodejs
```

and retry script.