jprichardson / node-fs-extra

Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
MIT License
9.47k stars 772 forks source link

TypeError: Cannot read property 'name' of undefined #926

Closed hepcat72 closed 3 years ago

hepcat72 commented 3 years ago
RyanZim commented 3 years ago

Are you running a stock version of Node.js? That error indicates that require('fs').realpath.native is undefined on your system

hepcat72 commented 3 years ago

This issue appears to be restricted to when you start homebridge using pm2. I have worked around the issue by switching to hb-service.

RyanZim commented 3 years ago

Yeah, something must be serving a non-standard version of fs there; not an issue with fs-extra.

hepcat72 commented 3 years ago

I encountered this immediately upon updating to Node v14.18.1. I don't actually know what fs is, or fs-extra for that matter. Could it be a permissions issue?

RyanZim commented 3 years ago

fs is Node's native filesystem module. fs-extra is a wrapper around it that adds some additional methods; but apparently somehow we're getting a non-standard version of `fs.

hepcat72 commented 3 years ago

I tried to check the version of fs, but I could not find it using npm ls. I just (re-?) installed it. Not sure how it could have gone missing, but I did note during my update process, there was a moment when one of the updates inadvertently removed a ton of stuff and I'd had to re-npm-install it all. So perhaps fs was removed... Not sure. I'll play around with it later and see if things work now after the fs install...

RyanZim commented 3 years ago

fs is a native node module, you don't need to install it; and there's no way it could be removed.

hepcat72 commented 3 years ago

Huh. OK. Well, obviously I don't know what I'm doing, so thanks for the hand-holding. Very kind. I'll have to invest some more mental effort to figure out how this happened. I probably should start my whole pi over from scratch.

roman-teamsystems commented 3 years ago

Hi @hepcat72.

I have the same issue. Did you solve yours somehow?

hepcat72 commented 3 years ago

No, I did not, but only because I simply haven't tried to figure it out. I just worked around the issue by switching from pm2 to hb-service to manage my homebridge process, though I am also having issues with node-red running via pm2. I can start it up, but after a reboot, it doesn't run and I have to start it manually. I don't know if it's related to fs* though - and I discovered that I had 2 competing pm2 installations (root vs pi). I uninstalled the root one and crossed my fingers, but I haven't checked with a reboot since then.

But take all this with a huge grain of salt because I don't know what the hell I'm doing. I probably used sudo somewhere where I shouldn't have or something. I'm too busy with a bathroom remodel to figure it out, so I'm just treading water until I have time to set up my new pi 4.