Comments (9)
Ah yeah that makes sense, so the Node version did not match the npm
version. If n
is already installed, we could actually just use it to update Node, instead of running our installer.
However, there were as well issues in the past related to incompatible local Node modules/dependencies. So if a reinstall is done, which includes a Node.js update, it makes sense to reinstall all modules from scratch. I also disabled the local cache now: 611c047
This increases traffic and processing. However, it makes sense for a reinstall, while for a Node-RED update only, it can be done with much less overhead, according to our docs: https://dietpi.com/docs/software/hardware_projects/#__tabbed_6_5
Additionally, our Node.js installer does not remove the global npm
and corepack
modules, before unpacking the new archive. This alone might have solved your issue already. Of course, it basically replaces the any Node version which may have been installed via n
. I do not remember exactly how it works, but I think it creates symlinks for modules and executables, which are replaced with actual files/dirs when the archive is unpacked.
from dietpi.
Can you show the content of the log file:
cat /mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T11_23_57_442Z-debug-0.log
from dietpi.
Sure, here you go:
~ ❯ cat /mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T11_23_57_442Z-debug-0.log
0 verbose cli /usr/local/bin/node /usr/local/bin/npm
1 info using [email protected]
2 info using [email protected]
3 silly config load:file:/usr/local/lib/node_modules/npm/npmrc
4 silly config load:file:/mnt/dietpi_userdata/node-red/.npmrc
5 silly config load:file:/usr/local/etc/npmrc
6 verbose title npm i node-red
7 verbose argv "i" "--no-audit" "node-red"
8 verbose logfile logs-max:10 dir:/mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T11_23_57_442Z-
9 verbose logfile /mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T11_23_57_442Z-debug-0.log
10 silly logfile start cleaning logs, removing 2 files
11 verbose stack TypeError: Class extends value undefined is not a constructor or null
11 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/minipass-collect/index.js:4:23)
11 verbose stack at Module._compile (node:internal/modules/cjs/loader:1460:14)
11 verbose stack at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
11 verbose stack at Module.load (node:internal/modules/cjs/loader:1275:32)
11 verbose stack at Module._load (node:internal/modules/cjs/loader:1091:12)
11 verbose stack at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
11 verbose stack at Module.require (node:internal/modules/cjs/loader:1297:12)
11 verbose stack at require (node:internal/modules/helpers:123:16)
11 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cacache/lib/get.js:3:17)
11 verbose stack at Module._compile (node:internal/modules/cjs/loader:1460:14)
12 error Class extends value undefined is not a constructor or null
13 verbose cwd /mnt/dietpi_userdata/node-red
14 verbose os Linux 6.1.21-v7+
15 verbose node v22.3.0
16 verbose npm v10.8.1
17 verbose exit 1
18 verbose code 1
19 error A complete log of this run can be found in: /mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T11_23_57_442Z-debug-0.log
from dietpi.
Hmm, npm
does a pretty bad job resolving conflicts between global and local modules. Looks like the minipass-collect
(which is part of the Node.js core installation) is too new for some of the locally installed Node-RED dependencies. I just do not get why this matters when one explicitly asks to install=update those local modules. However, you are not the first one who runs into such issue, when upgrading from certain older Node-RED versions. So let's solve this once and for all.
Can you test this:
cd /mnt/dietpi_userdata/node-red
sudo -u nodered npm i --no-audit node-red@latest
And if it does not work, this:
cd /mnt/dietpi_userdata/node-red
sudo -u nodered npm up --no-audit node-red
The hammer method is to remove all local modules and install them freshly. But if one of the above works, I would prefer it, causing less traffic and disk I/O:
cd /mnt/dietpi_userdata/node-red
sudo rm -R node_modules
npm i --no-audit node-red
EDIT: Ah, the last one is bad, because it removes all manually installed Node-RED plugins as well.
from dietpi.
Tested the first 2 options:
/mnt/dietpi_userdata/node-red ❯ sudo -u nodered npm i --no-audit node-red@latest
npm error Class extends value undefined is not a constructor or null
npm error A complete log of this run can be found in: /mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T14_11_26_351Z-debug-0.log
/mnt/dietpi_userdata/node-red ❯ sudo -u nodered npm up --no-audit node-red
npm error Class extends value undefined is not a constructor or null
npm error A complete log of this run can be found in: /mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T14_11_59_706Z-debug-0.log
Will look into the third option asap.
First want to make sure I do not have any manually installed stuff that could trip the installation up.
from dietpi.
First want to make sure I do not have any manually installed stuff that could trip the installation up.
Actually, when plugins were installed manually, they should show up in /mnt/dietpi_userdata/node-red/package.json
. Can you test this first?
cd /mnt/dietpi_userdata/node-red
sudo rm -R node_modules
sudo -u nodered npm up --no-audit
That should install and update all packages defined in package.json
and all their dependencies.
from dietpi.
Yes, exactly what I just did. :-)
Everything in there was installed through node-red, so I deleted the node_modules directory and tried again.
No luck:
/mnt/dietpi_userdata/node-red ❯ cat /mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T14_22_15_416Z-debug-0.log
0 verbose cli /usr/local/bin/node /usr/local/bin/npm
1 info using [email protected]
2 info using [email protected]
3 silly config load:file:/usr/local/lib/node_modules/npm/npmrc
4 silly config load:file:/mnt/dietpi_userdata/node-red/.npmrc
5 silly config load:file:/usr/local/etc/npmrc
6 verbose title npm i node-red
7 verbose argv "i" "--no-audit" "node-red"
8 verbose logfile logs-max:10 dir:/mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T14_22_15_416Z-
9 verbose logfile /mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T14_22_15_416Z-debug-0.log
10 silly logfile start cleaning logs, removing 2 files
11 verbose stack TypeError: Class extends value undefined is not a constructor or null
11 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/minipass-collect/index.js:4:23)
11 verbose stack at Module._compile (node:internal/modules/cjs/loader:1460:14)
11 verbose stack at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
11 verbose stack at Module.load (node:internal/modules/cjs/loader:1275:32)
11 verbose stack at Module._load (node:internal/modules/cjs/loader:1091:12)
11 verbose stack at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
11 verbose stack at Module.require (node:internal/modules/cjs/loader:1297:12)
11 verbose stack at require (node:internal/modules/helpers:123:16)
11 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cacache/lib/get.js:3:17)
11 verbose stack at Module._compile (node:internal/modules/cjs/loader:1460:14)
12 error Class extends value undefined is not a constructor or null
13 verbose cwd /mnt/dietpi_userdata/node-red
14 verbose os Linux 6.1.21-v7+
15 verbose node v22.3.0
16 verbose npm v10.8.1
17 verbose exit 1
18 verbose code 1
19 error A complete log of this run can be found in: /mnt/dietpi_userdata/node-red/.npm/_logs/2024-06-25T14_22_15_416Z-debug-0.log
from dietpi.
Hmm, last idea is the cache:
sudo rm -R .npm/_cacache
sudo -u nodered npm up --no-audit
EDIT: Actually, it seems to be also possibly that only some older globally installed modules break it:
- https://stackoverflow.com/questions/70383636/all-npm-commands-error-with-typeerror-class-extends-value-undefined-is-not-a-co
- https://stackoverflow.com/questions/70891176/every-time-i-run-npm-i-get-this-message-class-extends-value-undefined-is-not-a
- homebridge/homebridge#3002
So a general issue when upgrading from Node v14. In this particular case with minipass-collect
is is just strange, since this is part of the Node.js archive itself, same as npm
. So those 3 should be assured to be compatible with each other. Removing all globally installed modules on Node.js updates is of course not great either.
... looking further at it: I is actually not the globally installed minipass-collect
module, but the one shipped as (nested) dependency of npm
. On Node.js update, we just unpack the new archive onto the old /usr/local
, which means that theoretically /usr/local/lib/node_modules/npm/node_modules
can still have obsolete remains from old (incompatible) npm
versions. So if above does not work either, here another attempt:
sudo rm -R /usr/local/lib/node_modules/{corepack,npm}
dietpi-software reinstall 122
EDIT2: I added the corepack
and npm
removal to our Node.js installer as well now, so you could skip the first command. Whether it solves your particular issue or not, it makes sense in any case: MichaIng/nodejs-linux-installer@0b430e5
from dietpi.
So after some searching online I found that this is an error that sometimes occurs when using the n
tool to manage nod versions, which is what I have been doing for years. I deleted the n directory, then removed and reinstalled node-js using the dietpi-software tool.
Then used option 1 from your earlier post (#7128 (comment)) to install the latest node-red.
Node and node-red are now successfully running again, and node-red is on the latest version. I have not lost any data in node-red, so that's a win. Doing this does seem to have broken my pm2 install though, but I was only using pm2 for a single service, so fixing that should be relatively easy.
EDIT: pm2 started automatically again after a reboot, and my service is back up and running, so all is well.
Happy I got this far and thanks for your help on this!
from dietpi.
Related Issues (20)
- Open Beta v9.6 | Please help testing and hardening our upcoming release HOT 2
- ODROID N2+ can't find USB DAC with latest packages HOT 17
- Will more version be supported for nextcloud ? HOT 4
- Update cannot be finished HOT 1
- Bazarr not working (probably after 9.5.1 upgrade) HOT 7
- 37668978
- Dietpi-banner displays garbled RAM usage HOT 2
- Iteration v9.7 (2024-08-03)
- USB WiFi (TP-Link Archer T2U PLUS) adapter not working on Odroid N2+ since recent kernel upgrade HOT 7
- Dietpi-update fails to complete due to apt-key cannot create /dev/null HOT 8
- Radxa Zero 3W - Format eMMC fails Report 62215187-eddb-4247-9feb-69f6d693802e HOT 2
- Koel not working anymore after updating to version 7.0.2 HOT 8
- Error while updating diet Pi version from 9.4.2 to 9.6.1 HOT 10
- unable to update dietpi to latest version HOT 51
- mariaDB crashing HOT 10
- Multiple shells installed by default? HOT 2
- error
- Jre-17-headless incompatible with PaperMC 1.21 HOT 1
- Unable to upgrade DietPi from v9.5.1 to v9.6.1 HOT 14
- Parallels or UTM arm image HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dietpi.