Read the statement by Michael Teeuw here.
MMM-PIR-Sensor not work after v2.25
-
@JoeFranz if you ran my upgrade script it should fix that
you MUST install electron-rebuild in the base node_modules and execute it from there while in the module folder.
see the postinstall script in my fixed fork
-
@sdetweil after npm install:
Magic-Mirror-Module-PIR-Sensor@1.1.0 postinstall
node_modules/.bin/electron-rebuild -e …/…/node_modules/electronsh: 1: node_modules/.bin/electron-rebuild: not found
npm ERR! code 127
npm ERR! path /home/pi/MagicMirror/modules/MMM-PIR-Sensor
npm ERR! command failed
npm ERR! command sh -c node_modules/.bin/electron-rebuild -e …/…/node_modules/electronnpm ERR! A complete log of this run can be found in: /home/pi/.npm/_logs/2023-10-03T12_42_43_352Z-debug-0.log
-
@JoeFranz did you run this while the command prompt is in the module folder?
-
@sdetweil yes
-
@JoeFranz I am confused
(base) sam@sams:~/MagicMirror/modules$ cd MMM-PIR-Sensor/ (base) sam@sams:~/MagicMirror/modules/MMM-PIR-Sensor$ npm install > Magic-Mirror-Module-PIR-Sensor@1.1.0 postinstall > ./postinstall /home/sam/MagicMirror/modules/MMM-PIR-Sensor ⠹ Building module: epoll, Completed: 0make: Entering directory '/home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build' CXX(target) Release/obj.target/epoll/src/epoll.o ⠦ Building module: epoll, Completed: 0 SOLINK_MODULE(target) Release/obj.target/epoll.node COPY Release/epoll.node make: Leaving directory '/home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build' ✔ Rebuild Complete added 6 packages, and audited 7 packages in 13s found 0 vulnerabilities (base) sam@sams:~/MagicMirror/modules/MMM-PIR-Sensor$
and
(base) sam@sams:~/MagicMirror/modules/MMM-PIR-Sensor$ ./postinstall ✔ Rebuild Complete
node_modules/.bin/electron-rebuild -e …/…/node_modules/electron
this is HIS BROKEN postinstall which tries to execute it from the MODULE node_modules… which WILL NOT WORK anymore
I have a script which checks if it is installed in the base, if not installs it and THEN executes it FROM the base (note the leading … to point back to the base… )
../../node_modules/.bin/electron-rebuild
do this
cd ~/MagicMirror/modules/MMM-PIR_Sensor curl -sL https://raw.githubusercontent.com/sdetweil/MMM-PIR-Sensor/master/postinstall >postinstall chmod +x postinstall ./postinstall
OR rename the existing module folder to some other name
git clone and npm install mine…no code changes… just this packaging for rebuild
-
@sdetweil I renamed the folder and reinstalled the module, this is the result:
pi@raspberrypi:~/MagicMirror/modules/MMM-PIR-Sensor $ npm install npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated electron-rebuild@1.11.0: Please use @electron/rebuild moving forward. There is no API change, just a package name change npm ERR! code 7 npm ERR! path /home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll npm ERR! command failed npm ERR! command sh -c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@6.1.0 npm ERR! gyp info using node@20.8.0 | linux | arm npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3" npm ERR! gyp ERR! UNCAUGHT EXCEPTION npm ERR! gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#<Object>' npm ERR! gyp ERR! stack at createConfigFile (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/node-gyp/lib/configure.js:118:21) npm ERR! gyp ERR! stack at /home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/node-gyp/lib/configure.js:85:9 npm ERR! gyp ERR! stack at /home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/mkdirp/index.js:30:20 npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (node:fs:189:23) npm ERR! gyp ERR! System Linux 6.1.21-v7+ npm ERR! gyp ERR! command "/usr/bin/node" "/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/.bin/node-gyp" "rebuild" npm ERR! gyp ERR! cwd /home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll npm ERR! gyp ERR! node -v v20.8.0 npm ERR! gyp ERR! node-gyp -v v6.1.0 npm ERR! gyp ERR! This is a bug in `node-gyp`. npm ERR! gyp ERR! Try to update node-gyp and file an Issue if it does not help: npm ERR! gyp ERR! <https://github.com/nodejs/node-gyp/issues> npm ERR! A complete log of this run can be found in: /home/pi/.npm/_logs/2023-10-03T13_57_09_313Z-debug-0.log
-
@JoeFranz said in MMM-PIR-Sensor not work after v2.25:
“/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/.bin/node-gyp” “rebuild”
no… still using the wrong MMM-PIR-Sensor distro
delete the one you have and do
cd ~/MagicMirror/modules git clone https://github.com/sdetweil/MMM-PIR-Sensor.git cd MMM-PIR-Sensor npm install
-
@sdetweil ok, that worked now, my mistake :-(
I also made updates for the pi, unfortunately I now also have the latest firmware version: 82f3750a65fadae9a38077e3c2e217ad158c8d54 from March 2023. I’ve had that before, so the monitor on the pi doesn’t go into standby. I now need to downgrade the firmware to version 5.10 (b976c54917e240630c05a9b383010f1492bc61b4). When I try with “sudo rpi-update b976c54917e240630c05a9b383010f1492bc61b4” it says that the firmware is already up to date. -
@JoeFranz sorry on the firmware, don’t know how to downgrade firmware
-
@sdetweil Ok, I managed it :-)
Now everything is working again as it was before the update, thank you again :-)