Closed maqqju closed 8 years ago
Hmm, that's indeed unexpected. Can you describe how you're running this?
Also, node --version
, npm ls require-dir
, OS, etc. would be helpful.
Windows 8.1, Node v0.10.29, Require-Dir@0.3.0
How are you requiring it?
var requireDir = require('require-dir');
It is breaking on that line.
Any updates on this please?
Sorry about that — I missed your earlier reply.
Can you provide some more context? E.g. is this running in a file, or the REPL? Are you doing anything else with require
? (E.g. overriding require.main
or patching require
in any other way?) Are you using any other module that does something with require
AFAYK? Can you paste the whole stack trace?
I'm definitely grasping at straws here, because I've never heard of this error before. And the Travis CI tests even cover Node 0.10, so it wouldn't be that. I don't know about Windows though...
I am trying to write an app - so far it is very simple: just an app.js hooked to an index.html and inside the app.js I am requiring the package.
As I said - the error is being thrown when requiring the package. Seems odd to me too - however I have no patches or overrides.
Ah, you're running this browser-side? requireDir
is only supported on Node.js (server-side). Sorry if that was unclear in the readme. (Feedback welcome on how that could be made more clear.)
Let me know if I misunderstood.
Also, if I misunderstood, it might be most helpful if you could just share a GitHub Gist or similar with your code.
Hi @aseemk - thanks for that! Yes I was trying to use it from a browser.
Thanks for your time.
No problem! It might be possible to support the browser, but we can discuss that in issue #7. =)
I am trying to get the requireDir by calling require('require-dir') and am getting the following error:
"Cannot read property 'filename' of undefined".
For some reason, my module.parent is always being undefined - hence the problem.
Am I trying to require requireDir in the wrong context?