sdetweil / MagicMirror_scripts

Magic Mirror installation and setup scripts
337 stars 61 forks source link

ReferenceError: primordials is not defined #69

Closed BKeyport closed 8 months ago

BKeyport commented 9 months ago

install.log

soldatino13 commented 9 months ago

same error:

`evalmachine.:43 } = primordials; ^

ReferenceError: primordials is not defined at evalmachine.:43:5 at Object. (/usr/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8) at Module._compile (node:internal/modules/cjs/loader:1233:14) at Module._extensions..js (node:internal/modules/cjs/loader:1287:10) at Module.load (node:internal/modules/cjs/loader:1091:32) at Module._load (node:internal/modules/cjs/loader:938:12) at Module.require (node:internal/modules/cjs/loader:1115:19) at require (node:internal/modules/helpers:130:18) at Object. (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27) at Module._compile (node:internal/modules/cjs/loader:1233:14) `

raffaelloit commented 9 months ago

Same error here...


Check current NPM installation ...
NPM currently installed. Checking version number.
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)

Node.js v20.5.1
Minimum npm version: V10.1.0
Installed npm version: V
npm should be upgraded.
npm upgrade defered, doing test run  ...
papinist commented 9 months ago

Instructions say that this error was solved, but me too get all these "primordials is not defined" errors, even with the 'force' option.

sdetweil commented 9 months ago

ok will look at shortly

raffaelloit commented 9 months ago

Correction: After running the following script bash -c "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/node20_install.sh)" , the update could be performed without problems. Thanks for the support.

sdetweil commented 9 months ago

@papinist can you show me the output of

lsb_release -a

BKeyport commented 9 months ago

Fresh Pi Image using latest software - straight to install script:

Installing Node.js ...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfuse2
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 27.0 MB of archives.
After this operation, 183 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_20.x bullseye/main armhf nodejs armhf 20.5.1-deb-1nodesource1 [27.0 MB]
Fetched 27.0 MB in 5s (5,311 kB/s) 
Selecting previously unselected package nodejs.
(Reading database ... 106601 files and directories currently installed.)
Preparing to unpack .../nodejs_20.5.1-deb-1nodesource1_armhf.deb ...
Unpacking nodejs (20.5.1-deb-1nodesource1) ...
Setting up nodejs (20.5.1-deb-1nodesource1) ...
Processing triggers for man-db (2.9.4-2) ...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
nodejs is already the newest version (20.5.1-deb-1nodesource1).
The following package was automatically installed and is no longer required:
  libfuse2
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Node.js installation Done! version=v20.5.1
Check current NPM installation ...
NPM currently installed. Checking version number.
Minimum npm version: V10.1.0
Installed npm version: V9.8.0
npm should be upgraded.
Installing npm ...
E: Unable to correct problems, you have held broken packages.
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'npm@1.4.29',
npm WARN EBADENGINE   required: { node: '>=0.8', npm: '1' },
npm WARN EBADENGINE   current: { node: 'v20.5.1', npm: '9.8.0' }
npm WARN EBADENGINE }
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)

Node.js v20.5.1
npm installation Done! version=V
Cloning MagicMirror ...
Cloning into 'MagicMirror'...
remote: Enumerating objects: 376, done.
remote: Counting objects: 100% (376/376), done.
remote: Compressing objects: 100% (311/311), done.
remote: Total 376 (delta 69), reused 200 (delta 49), pack-reused 0
Receiving objects: 100% (376/376), 427.18 KiB | 2.19 MiB/s, done.
Resolving deltas: 100% (69/69), done.
Cloning MagicMirror Done!
Installing dependencies ...
bash: line 452: [: -ge: unary operator expected
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)

Node.js v20.5.1
Unable to install dependencies! 
BKeyport commented 9 months ago

Install will work if you run the node 20 installer script first, but throws repeated: "(node:7940) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit"

sdetweil commented 9 months ago

yes I see the maxlisteners thing too.

but I fixed the install and upgrade again to include the node20..

BKeyport commented 9 months ago

Indeed - it does seem to be working normally again, other than the maxlisteners thing.

BKeyport commented 9 months ago

Found and fixed my Mirror completely. Only weird thing is that PM2 will start up with everything stopped...

papinist commented 9 months ago

Now it worked for me too, thank you!

nibblerrick commented 9 months ago

Same problem here, even when running the node20 script before and when applying force to the upgrade script.

No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

And the error:

Node currently installed. Checking version number.
Minimum Node version: v20.8.0
Installed Node version: v20.8.0
No Node.js upgrade necessary.
Check current NPM installation ...
NPM currently installed. Checking version number.
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)

Node.js v20.8.0
Minimum npm version: V10.1.0
Installed npm version: V
npm should be upgraded.
Installing npm ...
E: Unable to correct problems, you have held broken packages.
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)

Node.js v20.8.0
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)

Node.js v20.8.0
npm installation Done! version=V

force: line 349: [: -ge: unary operator expected
saving custom.css
upgrading from version 2.25.0 to 2.25.0
fetching latest revisions
updating MagicMirror runtime, please wait
force: line 589: [: -ge: unary operator expected
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)

Node.js v20.8.0
Checking for modules with removed libraries
processing dependency changes for active modules with package.json files

processing for module MMM-Remote-Control please wait
----------------------------------
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)

Node.js v20.8.0
processing complete for module MMM-Remote-Control

processing for module MMM-Wallpaper please wait
----------------------------------
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)

Node.js v20.8.0
processing complete for module MMM-Wallpaper

processing for module MMM-MQTTbridge please wait
----------------------------------
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)

Node.js v20.8.0
processing complete for module MMM-MQTTbridge

processing for module MMM-homeassistant-sensors please wait
----------------------------------
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)

Node.js v20.8.0
processing complete for module MMM-homeassistant-sensors

restoring custom.css
sdetweil commented 9 months ago

where did u get bookworm from? I don't see that on the download page. https://www.raspberrypi.com/software/operating-systems/

is this 64bit?

post output of uname -a

nibblerrick commented 9 months ago

I did an in-place-upgrade. I've forgotten that raspbian (or now raspberry pi os) isn't debian, I am mostly just used to debian itself... Linux mm-ab-1 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l GNU/Linux So 32 bit here.

sdetweil commented 9 months ago

download the node20_install.sh script

curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/node20_install.sh >node20_install.sh edit the node20_install.sh and change

NODE_MAJOR=20

to

NODE_MAJOR=18

and run it locally ./node20_install.sh

let me know

do NOT try to run my upgrade script as it is still forcing node20... lets get thru this first...

nibblerrick commented 9 months ago

Thanks, node18 now installed, pm2 logs says:

/home/pi/.pm2/logs/MagicMirror-error.log last 15 lines:
0|MagicMir |     ^
0|MagicMir | 
0|MagicMir | ReferenceError: primordials is not defined
0|MagicMir |     at evalmachine.<anonymous>:43:5
0|MagicMir |     at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
0|MagicMir |     at Module._compile (node:internal/modules/cjs/loader:1256:14)
0|MagicMir |     at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
0|MagicMir |     at Module.load (node:internal/modules/cjs/loader:1119:32)
0|MagicMir |     at Module._load (node:internal/modules/cjs/loader:960:12)
0|MagicMir |     at Module.require (node:internal/modules/cjs/loader:1143:19)
0|MagicMir |     at require (node:internal/modules/cjs/helpers:119:18)
0|MagicMir |     at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
0|MagicMir |     at Module._compile (node:internal/modules/cjs/loader:1256:14)
0|MagicMir | 
0|MagicMir | Node.js v18.18.0

Looks like the same as before.

sdetweil commented 9 months ago

ok, now do this

pm2 stop all
cd ~/MagicMirror
rm -rf node_modules
npm run install-mm

then


npm start
nibblerrick commented 9 months ago

Hi,

in my MagicMirror directory there isn't a node_modules file or folder and nom run install-mm gives the already known error:

pi@mm-ab-1:~/MagicMirror $ ls
0             Collaboration.md  css         installers      jsconfig.json  module-types.ts    README.md     splashscreen  vendor
CHANGELOG.md  config            fonts       jest.config.js  LICENSE.md     package.json       run-start.sh  tests
clientonly    core              index.html  js              modules        package-lock.json  serveronly    translations
pi@mm-ab-1:~/MagicMirror $ rm -rf node_modules
pi@mm-ab-1:~/MagicMirror $ ls
0             Collaboration.md  css         installers      jsconfig.json  module-types.ts    README.md     splashscreen  vendor
CHANGELOG.md  config            fonts       jest.config.js  LICENSE.md     package.json       run-start.sh  tests
clientonly    core              index.html  js              modules        package-lock.json  serveronly    translations
pi@mm-ab-1:~/MagicMirror $ npm run install-mm
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)

Node.js v18.18.0
sdetweil commented 9 months ago

yeah you're failing on install. man I don't understand why they make this so hard.

nibblerrick commented 9 months ago

I'll try to get some time to make a new raspbian install, new MM install and try to swap the actual settings to the new install to see if it makes a difference.

sdetweil commented 9 months ago

@nibblerrick there is another 'test' thing to try

which ever exists

cd /usr/lib/node_modules/npm   
or 
cd /usr/local/lib/node_modules/npm

then

grep version node_modules/graceful_fs  (should NOT say 4.2.11 but 3. something
npm install graceful_fs@latest
grep version node_modules/graceful_fs   (should say 4.2.11)
node -v
nibblerrick commented 9 months ago

Sure. (graceful-fs instead of graceful_fs, right?) /usr/local/lib/node_modules/npm:

pi@mm-ab-1:~ $ cd /usr/local/lib/node_modules/npm
pi@mm-ab-1:/usr/local/lib/node_modules/npm $ grep version node_modules/graceful-fs/*
node_modules/graceful-fs/package.json:  "version": "3.0.2",
node_modules/graceful-fs/polyfills.js:    process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
node_modules/graceful-fs/README.md:* fixes `lchmod` for Node versions prior to 0.6.2.
grep: node_modules/graceful-fs/test: Is a directory
pi@mm-ab-1:/usr/local/lib/node_modules/npm $ npm install graceful_fs@latest
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)

Node.js v18.18.0
pi@mm-ab-1:/usr/local/lib/node_modules/npm $ npm install graceful-fs@latest
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)

Node.js v18.18.0

/usr/lib/node_modules/npm:

pi@mm-ab-1:/usr/local/lib/node_modules/npm $ cd /usr/lib/node_modules/npm   
pi@mm-ab-1:/usr/lib/node_modules/npm $ grep version node_modules/graceful-fs/*
node_modules/graceful-fs/graceful-fs.js:  // This is used in testing by future versions
node_modules/graceful-fs/graceful-fs.js:  // Patch fs.close/closeSync to shared queue version, because we need
node_modules/graceful-fs/graceful-fs.js:    var go$readdir = noReaddirOptionVersions.test(process.version)
node_modules/graceful-fs/graceful-fs.js:  if (process.version.substr(0, 4) === 'v0.8') {
node_modules/graceful-fs/graceful-fs.js:    // entries that are only a length of 2 are from an older version, don't
node_modules/graceful-fs/package.json:  "version": "4.2.11",
node_modules/graceful-fs/package.json:    "preversion": "npm test",
node_modules/graceful-fs/package.json:    "postversion": "npm publish",
node_modules/graceful-fs/polyfills.js:      process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
node_modules/graceful-fs/polyfills.js:    // Older versions of Node erroneously returned signed integers for
node_modules/graceful-fs/polyfills.js:    // Older versions of Node erroneously returned signed integers for
pi@mm-ab-1:/usr/lib/node_modules/npm $ npm install graceful-fs@latest
evalmachine.<anonymous>:43
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:43:5
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)

Node.js v18.18.0

(makes no difference if I use sudo)

sdetweil commented 9 months ago

so another piece of advice is wrong.

sorry, have to rebuild the SD card run my mm install script first make sure node & npm work node -v npm -v then restore the mm config

nibblerrick commented 9 months ago

I'll do that, hopefully this weekend. Let you know then if it resolves the weird issue or not. Thanks for your help!

nibblerrick commented 9 months ago

So some news: I made a new SD-Card and then ran your install-script. Same error. node20 script and then install, same. But I noticed then, that I managed accidentally to install 64 bit and nodejs couldn't be installed that way as with arch=aarch64 in the node sources.list it has broken dependencies. I removed then the MagicMirrorfolder and nodejs again, changed your script in line 211 and removed the $arch. After that it ran fine, restored my config, MM now online and working again. I now wonder what's in the node sources.list file of the earlier install. I'll look for another pi, because I have the old SD card, then I can try to investigate if there's more to find.

sdetweil commented 9 months ago

I do not add aarch64, only arm64.

sdetweil commented 9 months ago

this is the issue I opened in the node distro project https://github.com/nodesource/distributions/issues/1679

nibblerrick commented 9 months ago

Sorry, was arm64, not aarch64. Thanks for the linked issue, so 64bit seems to have a problem at the moment. When I ran the script the first time on the new machine and the primordials error occured that could be because of the wrong node version then. I just looked at the old sd-card, there isn't any arch and node is installed fine, so there's something else, maybe bookworm. Probably not worth searching further on the old installation as for normal installs the bug seems solved and the 64bit thing is something else.

nibblerrick commented 9 months ago

I checked the raspberry imager and for 64 bit I need to explicitly choose that. So I was confused, because I should have running a 32 bit system, but uname -m states aarch64. I searched and found this - so on rpi4 the default seems to be now a 64bit kernel, but the system is 32bit. May that explain why the nodesources.list with arch=arm64 fails, but without runs fine?

sdetweil commented 9 months ago

interesting.. I don't use the pi imager as it crashes on my amd desktop.. so I use the balana etcher https://etcher.balena.io/

and download the image manually

I only get the 64 bit kernel when I specifically flash that image

nibblerrick commented 9 months ago

If I understand correctly it not only happens when flashing with the rpi-imager but can also happen when just apt update && apt upgrade. But it looks there's another way to differentiate: 32bit:

pi@mm-ab-1:~ $ uname -m
aarch64
pi@mm-ab-1:~ $ dpkg --print-architecture
armhf

64bit:

pi@BarcodeScreen:~ $ uname -m
aarch64
pi@BarcodeScreen:~ $ dpkg --print-architecture
arm64

Probably dpkg --print-architecture is a more secure way to determine if 32 or 64bit packages?

sdetweil commented 9 months ago

thanks..

nibblerrick commented 8 months ago

I have to thank you for these excellent scripts which have saved me much time and are so convenient!

sdetweil commented 8 months ago

see these updated scripts too..

https://forum.magicmirror.builders/topic/18072/install-upgrade-scripts-changed-for-version-2-25-and-node-20

camillemarius commented 8 months ago

Your "testit" branch has fixed the problem described earlier, which I also experienced. MM is now back online and working smoothly. Thank you!

sdetweil commented 8 months ago

@camillemarius @nibblerrick the testit branch has been merged back to master.. thanks for your patience and help..

sdetweil commented 8 months ago

can we close this now?

nibblerrick commented 8 months ago

Sorry for getting back so late, from my end this can be closed, thank you very much!