I have had the exact same errors during install and there was no way to fix it. I tried all options mentioned here like the backup and do a new install “npm install pimatic --prefix pimatic-app --production”, or the “sudo npm install pimatic@0.9.42 --prefix pimatic-app --production”.
Nothing! The 0.9.43 did not install correct. The 0.9.42 installed correctly but would not start.
I did the upgrade (tried the upgrade) just yesterday evening after my holidays.
So after a couple of hours trying, I finally restored pimatic from my (last week) Sat/Sun full server backup.
Now I’m back on 0.9.42
It is globally installed and it is autostarted via the init.d script. Next to that it is “ssl-ed” and running on a 443 port.
Updates mentions (now again):

Found update for pimatic: current version is 0.9.42, latest version is: 0.9.43
Found update for pimatic-knmi-weather: current version is 0.9.3, latest version is: 0.9.4
Found update for pimatic-telegram: current version is 1.1.10, latest version is: 1.1.11

The NODE_PATH is misssing.
So I added NODE_PATH="/usr/local/bin" to my system wide /etc/profile and rebooted.
Then I did the upgrade again from pimatic, but it still failed. It is not in the package.json b.t.w.
Then I did a restore again, I removed NODE_PATH again from my /etc/profile and did a sudo npm install dir-reader.
Then again an update from pimatic but it still didn’t work as it still mentions “dir-reader.js not found”. (sigh) So a restore again.
Then I first did a sudo npm cache clean and then the upgrade. It still crashes on the exact same errors (sigh).
Restored again and I now leave it to 0.9.42 for the time being.

(If NODE_PATH gets added to the package.json of the pimatic package, will it solve this issue?)

Problem is that stream is missing the file dir-reader.js. So it won’t help to install dir-reader using npm.

Please check if the file /home/harryvanderwolf/pimatic/pimatic-app/node_modules/pimatic/node_modules/npm/node_modules/fstream/lib/dir-reader.js is really missing.

If its missing you can try to install fstream again. Remove/home/harryvanderwolf/pimatic/pimatic-app/node_modules/pimatic/node_modules/npm/node_modules/fstream completely and runsudo npm install
from/home/harryvanderwolf/pimatic/pimatic-app/node_modules/pimatic/node_modules/npm/.

This should install fstream again, hopefully including the missing file.

Thanks for your reply.
However, I do have the file dir-reader.js in fstream in my local pimatic-app folder as well as in /usr/local/lib, and they are identical.
Next to that: I have multiple versions of dir-reader.js also under other modules like sqlite3 in my pimatic-app modules folder structure.

However, I do have the file dir-reader.js in fstream in my local pimatic-app folder as well as in /usr/local/lib, and they are identical.

Not sure why there is one in /usr/local/lib. It shouldn’t have any effect.

Next to that: I have multiple versions of dir-reader.js also under other modules like sqlite3 in my pimatic-app modules folder structure.

Same with me. That’s normal, because fstream seems to be a popular library. Nevertheless you still try do delete fstream from there and install it again like I wrote before. It’s worth a try, and I think i fixed it this way, too.

Same with me. That’s normal, because fstream seems to be a popular library. Nevertheless you still try do delete fstream from there and install it again like I wrote before. It’s worth a try, and I think i fixed it this way, too.

Removed it and reinstalled it. Rebooted and did the upgrade and again it doesn’t work and keeps complaining about the dir-reader.js npm not found.
I’m so experienced in restoring now.