Closed nhweb closed 10 months ago
Which Node.js version is installed?
Now I have installed v20.11.0. Previously v16.10 was installed.
After the update to v20 I have completly deleted the entire MMM-GooglePhotos directory and did a new installation. Also with this:
cd ~/MagicMirror/modules/MMM-GooglePhotos
npm install --save-dev electron-rebuild
./node_modules/.bin/electron-rebuild # It could takes dozens sec.
It should be fine with Node.js v20 and npm install
. Does it works if you execute npm install
again?
I executed it now again:
pi@pidisplay:~/MagicMirror/modules/MMM-GooglePhotos $ npm install
up to date, audited 374 packages in 4s
93 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
pi@pidisplay:~/MagicMirror/modules/MMM-GooglePhotos $
But still the same.
What happens when you execute the following command?
node -e 'fetch("https://httpbin.org/headers").then(r=>r.json()).then(r=>console.log(r))'
This:
pi@pidisplay:~/MagicMirror/modules/MMM-GooglePhotos $ node -e 'fetch("https://httpbin.org/headers").then(r=>r.json()).then(r=>console.log(r))'
{
headers: {
Accept: '*/*',
'Accept-Encoding': 'br, gzip, deflate',
'Accept-Language': '*',
Host: 'httpbin.org',
'Sec-Fetch-Mode': 'cors',
'User-Agent': 'node',
'X-Amzn-Trace-Id': 'Root=1-659ff506-223eee0d09265cfa497ca095'
}
}
pi@pidisplay:~/MagicMirror/modules/MMM-GooglePhotos $
The error "ReferenceError: fetch is not defined" should be gone away. Are you starting MM with command npm start
in ~/MagicMirror?
No, unfortunately not. Normally I use pm2 to start and stop. But now I startet with npm start, but with same error:
[11.01.2024 15:11.58.188] [ERROR] (node:16430) UnhandledPromiseRejectionWarning: ReferenceError: fetch is not defined
at Class.tryToIntitialize (/home/pi/MagicMirror/modules/MMM-GooglePhotos/node_helper.js:151:24)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
(Use `electron --trace-warnings ...` to show where the warning was created)
[11.01.2024 15:11.58.189] [ERROR] (node:16430) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
It is likely the old Nodejs v16 is still in your machine and pm2 execute with that one instead of v20. You can try to reboot the machine to see if it is fine. Also, you can create new js file with the following command (or you can put the above fetch script as well) and start by pm2 to check runtime version.
console.log(process.versions.node)
But with npm start I am getting the same error. Several restarts later, still the same.
I also created a test file and have started it with pm2. In the test-out.log file there ist 20.11.0
What else can I do?
Could you please try with this version? https://github.com/hermanho/MMM-GooglePhotos/tree/fix/182
Hello, now I tried to install the fix version. But now MM stucks in black screen and in the mm-error.log file are the following errors:
[12.01.2024 08:06.46.588] [ERROR] [31mWARNING! Could not validate config file. Starting with default configuration. Please correct syntax errors at or above this line: /home/pi/MagicMirror/modules/MMM-GooglePhotos/node_helper.js:2[39m
[31mimport './fetch-polyfill';[39m
[31m^^^^^^[39m
[31mSyntaxError: Cannot use import statement outside a module[39m
[31m at Object.compileFunction (node:vm:360:18)[39m
[31m at wrapSafe (node:internal/modules/cjs/loader:1062:15)[39m
[31m at Module._compile (node:internal/modules/cjs/loader:1097:27)[39m
[31m at Module._extensions..js (node:internal/modules/cjs/loader:1196:10)[39m
[31m at Module.load (node:internal/modules/cjs/loader:1011:32)[39m
[31m at Module._load (node:internal/modules/cjs/loader:846:12)[39m
[31m at f._load (node:electron/js2c/asar_bundle:2:13328)[39m
[31m at Module.require (node:internal/modules/cjs/loader:1035:19)[39m
[31m at require (node:internal/modules/cjs/helpers:102:18)[39m
[31m at loadModule (/home/pi/MagicMirror/js/app.js:127:19)[39m
[12.01.2024 08:06.46.594] [ERROR] App threw an error during load
[12.01.2024 08:06.46.595] [ERROR] /home/pi/MagicMirror/modules/MMM-GooglePhotos/node_helper.js:2
import './fetch-polyfill';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1062:15)
at Module._compile (node:internal/modules/cjs/loader:1097:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
at Module.load (node:internal/modules/cjs/loader:1011:32)
at Module._load (node:internal/modules/cjs/loader:846:12)
at f._load (node:electron/js2c/asar_bundle:2:13328)
at Module.require (node:internal/modules/cjs/loader:1035:19)
at require (node:internal/modules/cjs/helpers:102:18)
at loadModule (/home/pi/MagicMirror/js/app.js:127:19)
[12.01.2024 08:06.46.596] [ERROR] Whoops! There was an uncaught exception...
[12.01.2024 08:06.46.600] [ERROR] /home/pi/MagicMirror/modules/MMM-GooglePhotos/node_helper.js:2
import './fetch-polyfill';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1062:15)
at Module._compile (node:internal/modules/cjs/loader:1097:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
at Module.load (node:internal/modules/cjs/loader:1011:32)
at Module._load (node:internal/modules/cjs/loader:846:12)
at f._load (node:electron/js2c/asar_bundle:2:13328)
at Module.require (node:internal/modules/cjs/loader:1035:19)
at require (node:internal/modules/cjs/helpers:102:18)
at loadModule (/home/pi/MagicMirror/js/app.js:127:19)
[12.01.2024 08:06.46.600] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[12.01.2024 08:06.46.600] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
What else can I do?
I've seen there were some files changed today, so I reinstalled it. But for now I am getting the following error:
[12.01.2024 08:39.57.806] [ERROR] (node:20065) UnhandledPromiseRejectionWarning: TypeError: Readable.fromWeb is not a function
at Class.tryToIntitialize (/home/pi/MagicMirror/modules/MMM-GooglePhotos/node_helper.js:153:31)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
(Use `electron --trace-warnings ...` to show where the warning was created)
[12.01.2024 08:39.57.806] [ERROR] (node:20065) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
Please could you execute the following command in MagicMirror directory to check the version?
npm ls electron
Yes sure.
pi@pidisplay:~/MagicMirror $ npm ls electron
magicmirror@2.22.0 /home/pi/MagicMirror
`-- electron@22.0.0
It seems the MagicMirror version is an old version. The latest one v2.26.0 is depended on electron v27. Please update the MagicMirror to the latest version and re-install MMM-GooglePhotos from master branch. It should be fine.
Ok, thank you, for first step I updated electron, now it works. But yes, MM is noch the latest version. I will update it.
Thanks a lot.
Hello,
I know there are a few posts about this, but none with my error. The installation and configuration went fine, but ist stucks on Loading... In the mm-error.log I could find these:
In the mm-out.log, there is only this to find:
What to do? The credentials and token exists. Holger