__dirname does not work


#1

I was using path module and while using it, I’d to use __dirname but it wasn’t working, I’m sure the path was correct that I provided.


#2

Hey @Bolt I think I’m a little confused. The Node.js global __dirname appears to work fine for me; adding console.log(__dirname); to a trivial project shows me /app in the console as I’d expect.

Are you trying to work with path.dirname()? Can you provide some sample code or a project name?


#3

Hey @Bolt,

Can you show the piece of the code that is throwing an error?

This is so I can look into it and look what you’ve done wrong.

~Rienknr1


#4

I have tried logging dirname, still it doesn’t work.


#5

Please provide some sample code or a project name, we can’t help you without that info.