Closed MDAR closed 3 years ago
fyi, v3 switched to ESM only, you can no longer use require to load node-fetch if you are stuck with cjs then it would be best to stick with v2
(based it on: at Module._compile (node:internal/modules/ -> cjs <-/loader:1101:14)
Since it is installed via npm, it should be v2.0.5: https://www.npmjs.com/package/node-red This is also the latest official release: https://nodered.org/ Never heard of v3 yet?
However, the error happens when socks-proxy-agent
is installed as dependency of make-fetch-happen
, if I understand it right, so it has not directly something to do with Node-RED.
EDIT: Ah nope, these modules are globally installed, as part of Node.js itself, while Node-RED is installed as local module in /mnt/dietpi_userdata/nodered
.
I just tested in on VM, where it works perfectly fine. Testing on aarch64...
Hi
thanks for looking at this go quickly.
All I have done is try to update Node-Red using
dietpi-software reinstall 122
Who knows what I have done with the machine,
I'll put a fresh copy of DietPi on it tomorrow and start again.
They only run
So not a big deal to start from scratch
Do you want me to test anything before I wipe this machine?
FYI
Just tried that command again, and I just see the following after it looks like it is going to work
Command: sudo -u nodered npm i --no-audit node-red │
│ - Exit code: 1 │
│ - DietPi version: v7.5.2 (MichaIng/master) | HW_MODEL: 16 | HW_ARCH: 3 | DISTRO: 5 │
│ - Image creator: DietPi Core Team │
│ - Pre-image: Meveric │
│ - Error log: │
│ TypeError: Class extends value undefined is not a constructor or null │
│ at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/socks-proxy-agent/dist/agent.js:114:44) │
│ at Module._compile (node:internal/modules/cjs/loader:1101:14) │
│ at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) │
│ at Module.load (node:internal/modules/cjs/loader:981:32) │
│ at Function.Module._load (node:internal/modules/cjs/loader:822:12) │
│ at Module.require (node:internal/modules/cjs/loader:1005:19) │
│ at require (node:internal/modules/cjs/helpers:94:18) │
│ at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/socks-proxy-agent/dist/index.js:5:33) │
│ at Module._compile (node:internal/modules/cjs/loader:1101:14) │
│ at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) │
│ at Module.load (node:internal/modules/cjs/loader:981:32) │
│ at Function.Module._load (node:internal/modules/cjs/loader:822:12) │
│ at Module.require (node:internal/modules/cjs/loader:1005:19) │
│ at require (node:internal/modules/cjs/helpers:94:18) │
│ at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/agent.js:161:25) │
│ at Module._compile (node:internal/modules/cjs/loader:1101:14)
It is always this command that throws a tantrum
sudo -u nodered npm i --no-audit node-red
I'll come back to it tomorrow
I just tested a fresh install and reinstall as well on aarch64, and didn't face any issues. Node.js itself is always reinstalled freshly, so unlikely that something went wrong with it's unpacking or so two times. But the new files are extracted over the old files, so I'm not 100% sure if old obsolete files may cause problems. The ones shown in your error however exist as well on a fresh install. It could be something with the old local Node-RED modules, not sure.
Probably the following solves it already, starting with fresh Node and Node-RED modules (preserving data and configs):
rm -R /usr/local/lib/node_modules
rm -R /usr/local/include/node
rm -R /mnt/dietpi_userdata/node-red/{node_modules,package-lock.json,package.json,.cache,.npm}
dietpi-software reinstall 122
But you need to again install nodes which you installed via Node-RED's palette manager.
Btw, if you only want to update Node-RED, while a reinstall usually works for this (and includes updating Node.js), the following is sufficient (as described in our docs):
systemctl stop node-red
cd /mnt/dietpi_userdata/node-red
sudo -u nodered npm up --no-audit node-red
systemctl start node-red
Looking at our SSH paste, it is important to run npm
from within the Node-RED data directory, else npm
tries to install a fresh instance within the current directory. That may already have partly happened in your home directory: ls -l ~
And you installed npm
from the Debian repository. Generally this would be an alternative to test, but it is a much older version, compared to the one we install from Node.js downloads directly. And the package as you install it won't have any effect unless you remove the Node.js installed via dietpi-software
: The package installs the command to /usr/bin/npm
while we install it to /usr/local/bin/npm
, from where executables are picked first. So another test would be indeed to uninstall Node.js via dietpi-software
, then run the above 4 commands to try updating Node-RED. If that fails as well, then I suggest to remove the obsolete package and all the dependencies it pulled:
apt purge --autoremove npm
Thank you so much for your time and guidance, in just 5 minutes Node-RED was installed again. (With Version 2.0.6)
All I did was the following
Boot up
rm -R /usr/local/lib/node_modules
rm -R /usr/local/include/node
rm -R /mnt/dietpi_userdata/node-red/{node_modules,package-lock.json,package.json,.cache,.npm} [Although this folder was not present]
apt purge --autoremove npm
dietpi-software install 122
I did try dietpi-software reinstall 122
but that reported "no changes" as node-red had been removed.
Thank you again.
a quick edit of the /mnt/dietpi_userdata/node-red/settings.js
and import of a backup and everything was back to how it should be
dietpi-software reinstall 122
instead of dietpi-software install 122
would have worked.
dietpi-software reinstall 122
instead ofdietpi-software install 122
would have worked.
😄
Either way, I'm delighted that its all back up and running.
(Now I just have to find out if there are any dramatic changes in Node-RED v2 that will affect any of my production machines)
Thanks again 😄
Hi @MichaIng
I'm really sorry about this.
I'm trying to update another machine and this time the dietpi-software install 122
process is halting when it comes to downloading this file
https://raw.githubusercontent.com/MichaIng/nodejs-linux-installer/master/node-install.sh
It seems to be unavailable
- Date | Thu Sep 16 23:04:13 BST 2021
- Bug report | 4418a821-f302-4d8c-95be-e9225a6d11b5
- DietPi version | v6.34.3 (MichaIng/master)
- Image creator | DietPi Core Team
- Pre-image | Meveric
- Hardware | Odroid C2 (aarch64) (ID=12)
- Kernel version | Linux LiveStream-C2 3.16.85+ #1 SMP PREEMPT Tue Jun 30 19:02:35 CEST 2020 aarch64 GNU/Linux
- Distro | stretch (ID=4)
- Command | curl -ILfvm 5 https://raw.githubusercontent.com/MichaIng/nodejs-linux-installer/master/node-install.sh
- Exit code | 28
- Software title | DietPi-Software
could you try to execute following on your system
cd /tmp
curl -ILfvm 5 https://raw.githubusercontent.com/MichaIng/nodejs-linux-installer/master/node-install.sh
curl -ILfvm 5 https://raw.githubusercontent.com/MichaIng/nodejs-linux-installer/master/node-install.sh
😢
This is what I get
/tmp# curl -ILfvm 5 https://raw.githubusercontent.com/MichaIng/nodejs-linux-installer/master/node-install.sh
* Trying 185.199.110.133...
* TCP_NODELAY set
* Connected to raw.githubusercontent.com (185.199.110.133) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* Operation timed out after 5001 milliseconds with 0 out of 0 bytes received
* Curl_http_done: called premature == 1
* stopped the pause stream!
* Closing connection 0
curl: (28) Operation timed out after 5001 milliseconds with 0 out of 0 bytes received
Just putting this line in a web browser to see what is pulled down, just ends with a timeout
https://raw.githubusercontent.com/MichaIng/nodejs-linux-installer/master/node-install.sh
Is the issue anything to do with the fact that this box is running DietPi 6.34.3 ?
Is there an SSL certificate issue at play?
FYI
dietpi-update
seems to fail too
it just seems to wait a very long time at the first step, then finally ends with this
DietPi-Update
─────────────────────────────────────────────────────
Phase: Checking for available DietPi update
[ INFO ] DietPi-Update | Checking mirror: https://raw.githubusercontent.com/MichaIng/DietPi/master/dietpi/server_version-6
curl: (35) Unknown SSL protocol error in connection to raw.githubusercontent.com:443
[ INFO ] DietPi-Update | No valid response from: https://raw.githubusercontent.com/MichaIng/DietPi/master/dietpi/server_version-6 ()
[ INFO ] DietPi-Update | Checking mirror: https://dietpi.com/downloads/dietpi-update_mirror/master/server_version-6
curl: (22) The requested URL returned error: 404
[ INFO ] DietPi-Update | No valid response from: https://dietpi.com/downloads/dietpi-update_mirror/master/server_version-6 ()
[FAILED] DietPi-Update | Unable to access any update server. Please check your network connection, then rerun dietpi-update.
If this error persists, please report at: https://github.com/MichaIng/DietPi/issues
[ INFO ] DietPi-Update | APT update, please wait...
Ign:1 https://deb.debian.org/debian stretch InRelease
Hit:2 https://deb.debian.org/debian stretch-updates InRelease
Hit:3 https://deb.debian.org/debian-security stretch/updates InRelease
Hit:4 https://deb.debian.org/debian stretch-backports InRelease
Hit:5 https://deb.debian.org/debian stretch Release
Hit:6 https://dietpi.com/meveric all InRelease
Hit:7 https://dietpi.com/meveric stretch InRelease
Reading package lists...
[ OK ] DietPi-Update | APT update
[ INFO ] DietPi-Update | No APT upgrades were found, not creating file: /run/dietpi/.apt_updates
This was all triggered because I was trying to add another palette and Node-RED (on two machines in this building) didn't populate the palette manager >> install
window.
Eventually issuing a pop up to that effect
😢
Now this is super odd.
If I put my laptop onto the mobile hotspot of my phone, I pull down the node-install.sh file from github in a browser.
But it seems the ISP is blocking traffic from GitHub, or at least certain pages.
As far as a I know, there isn't a firewall in place, I can ask tomorrow when their office opens.
I've pasted the text into a SH file on the Odroid.
Do you happen to know the parameters I need to pass to the script for it to work?
the script is simply executed as far as I can see.
Is the issue anything to do with the fact that this box is running DietPi 6.34.3 ? Is there an SSL certificate issue at play?
If I understood correctly, you have same issue putting the URL into a browser on your laptop. Means it is not dedicated on your DietPin device
the script is simply executed as far as I can see.
Is the issue anything to do with the fact that this box is running DietPi 6.34.3 ? Is there an SSL certificate issue at play?
If I understood correctly, you have same issue putting the URL into a browser on your laptop. Means it is not dedicated on your DietPi device
I'm very quickly coming to the point where I agree with you 100%
I'm also trying to load the ESP32 board details into Ardunio on my laptop and part of that process is being blocked too.
But again, if I connect my laptop to my phone's hot-spot, it downloads.
I'll call the ISP tomorrow and see what is happening, (I know that they have been the victims of a DoS attack recently, so maybe things are locked down a little right now)
Thanks very much for your help, I really do appreciate it.
@Joulinar
Thanks for helping last night and keeping my sanity in check.
It turns out that there was an issue with the ISP and they got me to change the MTU value this morning and everything has started to work normally again.
Required Information
DietPi version | G_DIETPI_VERSION_CORE=7 G_DIETPI_VERSION_SUB=5 G_DIETPI_VERSION_RC=2 G_GITBRANCH='master' G_GITOWNER='MichaIng' G_LIVE_PATCH_STATUS[0]='not applicable'
Distro version | 10.10
Kernel version | Linux openHAB2-C4 4.9.241-arm64 # 1 SMP PREEMPT Thu Feb 25 17:57:15 CET 2021 aarch64 GNU/Linux
SBC model | Odroid C4/HC4 (aarch64)
Power supply used | 5V 2A
SDcard used | eMMC 16GB
Additional Information (if applicable)
Details:
Linux openHAB2-C4 4.9.241-arm64 #1 SMP PREEMPT Thu Feb 25 17:57:15 CET 2021 aarch64 GNU/Linux
sudo -u nodered npm i --no-audit node-red
Steps to reproduce
dietpi-software reinstall 122
Expected behaviour
Actual behaviour
Extra details
SCREEN DUMP from full SSH session
``` Image by : DietPi Core Team (pre-image: Meveric) Web : https://dietpi.com | https://twitter.com/DietPi_ Patreon Legends : Camry2731 Contribute : https://dietpi.com/contribute.html DietPi Hosting : Powered by https://myvirtualserver.com dietpi-launcher : All the DietPi programs in one place dietpi-config : Feature rich configuration tool for your device dietpi-software : Select optimised software for installation htop : Resource monitor cpu : Shows CPU information and stats root@openHAB2-C4:~# systemctl status node-red Unit node-red.service could not be found. root@openHAB2-C4:~# dietpi-software [ OK ] DietPi-Software | Initialised database [ OK ] DietPi-Software | Reading database [ OK ] DietPi-Software | Free space check: path=/ | available=6486 MiB | required=500 MiB [ OK ] DietPi-Software | DietPi-Userdata validation: /mnt/dietpi_userdata [ OK ] DietPi-Software | Checking network connectivity [ OK ] DietPi-Software | Checking DNS resolver [ OK ] Network time sync | Completed [ SUB1 ] DietPi-Services > unmask [ OK ] DietPi-Services | unmask : nmbd [ OK ] DietPi-Services | unmask : smbd [ OK ] DietPi-Services | unmask : cron [ SUB1 ] DietPi-Services > stop [ OK ] DietPi-Services | stop : cron [ OK ] DietPi-Services | stop : smbd [ OK ] DietPi-Services | stop : nmbd [ OK ] DietPi-Software | mkdir -p /mnt/dietpi_userdata/Music /mnt/dietpi_userdata/Pictures /mnt/dietpi_userdata/Video /mnt/dietpi_userdata/dow nloads /var/www /opt [ OK ] DietPi-Software | chown dietpi:dietpi /mnt/dietpi_userdata/Music /mnt/dietpi_userdata/Pictures /mnt/dietpi_userdata/Video /mnt/dietpi_u serdata/downloads [ OK ] DietPi-Software | chmod 0775 /mnt/dietpi_userdata/Music /mnt/dietpi_userdata/Pictures /mnt/dietpi_userdata/Video /mnt/dietpi_userdata/d ownloads [ INFO ] DietPi-Software | APT update, please wait... Hit:1 https://deb.debian.org/debian buster InRelease Hit:2 https://deb.debian.org/debian buster-updates InRelease Hit:3 https://deb.debian.org/debian-security buster/updates InRelease Hit:4 https://deb.debian.org/debian buster-backports InRelease Hit:5 https://dietpi.com/meveric all InRelease Hit:6 https://dietpi.com/meveric buster InRelease Hit:7 https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable InRelease Reading package lists... [ OK ] DietPi-Software | APT update DietPi-Software ───────────────────────────────────────────────────── Mode: Checking for prerequisite software [ INFO ] DietPi-Software | Node.js will be reinstalled [ INFO ] DietPi-Software | Build-Essential will be reinstalled DietPi-Software ───────────────────────────────────────────────────── Mode: Installing Build-Essential: GNU C/C++ compiler, development libraries and headers [ INFO ] DietPi-Software | APT install for: g++ make automake, please wait... [ OK ] DietPi-Software | APT install for: g++ make automake DietPi-Software ───────────────────────────────────────────────────── Mode: Installing Node.js: JavaScript runtime environment [ OK ] DietPi-Software | Checking URL: https://raw.githubusercontent.com/MichaIng/nodejs-linux-installer/master/node-install.sh [ OK ] DietPi-Software | cd /tmp/DietPi-Software [ INFO ] DietPi-Software | G_THREAD_START_0 | curl -sSfL https://raw.githubusercontent.com/MichaIng/nodejs-linux-installer/master/node-install.s h -o node-install.sh [ INFO ] DietPi-Software | APT install for: libatomic1, please wait... [ OK ] DietPi-Software | APT install for: libatomic1 [ OK ] DietPi-Software | G_THREAD: All threads finished [ OK ] DietPi-Software | chmod +x node-install.sh [ INFO ] DietPi-Software | ./node-install.sh, please wait... Universal Node.js Linux Installer by github.com/taaem, updated by github.com/MichaIng root permissions verified Searching latest stable version for aarch64 ... Found latest stable version for aarch64: node-v16.8.0-linux-arm64.tar.gz Downloading https://nodejs.org/dist/latest/node-v16.8.0-linux-arm64.tar.gz ... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 9 31.4M 9 3085k 0 0 3408k 0 0:00:09 --:--:-- 0:00:09 3405khttps://raw.githubusercontent.com/MichaIng/nodejs-linux-installer/ 100 31.4M 100 31.4M 0 0 7534k 0 0:00:04 0:00:04 --:--:-- 7534k Finished downloading! Installing /tmp/node.tar.gz ... removed '/tmp/node.tar.gz' Finished installing! [ OK ] DietPi-Software | ./node-install.sh [ OK ] DietPi-Software | rm node-install.sh DietPi-Software ───────────────────────────────────────────────────── Mode: Installing Node-RED: tool for wiring devices, APIs and online services [ OK ] DietPi-Software | mkdir -p /mnt/dietpi_userdata/node-red [ OK ] DietPi-Software | Verifying user "nodered" to run Node-RED [ OK ] DietPi-Software | useradd -rMU -d /mnt/dietpi_userdata/node-red -s /usr/sbin/nologin nodered [ OK ] DietPi-Software | chown -R nodered:nodered /mnt/dietpi_userdata/node-red [ INFO ] DietPi-Software | APT install for: python3, please wait... [ OK ] DietPi-Software | APT install for: python3 [ OK ] DietPi-Software | cd /mnt/dietpi_userdata/node-red [ INFO ] DietPi-Software | sudo -u nodered npm i --no-audit node-red, please wait... TypeError: Class extends value undefined is not a constructor or null at Object.