Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hepcat72 opened this issue Oct 16, 2021 · 10 comments
Closed

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

hepcat72 opened this issue Oct 16, 2021 · 10 comments

Comments

@hepcat72
Copy link

  • Operating System: Raspbian
  • Node.js version: v14.18.1
  • fs-extra version::
>sudo npm ls -g fs-extra
/usr/local/lib
└─┬ homebridge@1.3.5
  └── fs-extra@10.0.0

I hope this is the right place to report this issue. I see this error in my homebridge installation (which installs fs-extras as a dependency I believe) constantly in my homebridge error log:

TypeError: Cannot read property 'name' of undefined
    at exports.fromCallback (/usr/lib/node_modules/homebridge/node_modules/universalify/index.js:15:26)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge/node_modules/fs-extra/lib/fs/index.js:57:27)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function._load (/usr/lib/node_modules/pm2/node_modules/@pm2/io/src/metrics/httpMetrics.ts:190:35)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge/node_modules/fs-extra/lib/index.js:5:6)

What can I do to address this?

@RyanZim
Copy link
Collaborator

RyanZim commented Oct 16, 2021

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

@hepcat72
Copy link
Author

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
Copy link
Collaborator

RyanZim commented Oct 18, 2021

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

@RyanZim RyanZim closed this as completed Oct 18, 2021
@hepcat72
Copy link
Author

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
Copy link
Collaborator

RyanZim commented Oct 25, 2021

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
Copy link
Author

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
Copy link
Collaborator

RyanZim commented Oct 27, 2021

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

@hepcat72
Copy link
Author

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
Copy link

Hi @hepcat72.

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

@hepcat72
Copy link
Author

hepcat72 commented Nov 5, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants