node.jsexpress

Error message "ENOENT, no such file or directory"


I'm getting this error from my Node.js application:

ENOENT, no such file or directory '~/Desktop/MyApp/newversion/partials/navigation.jade'

I know the file is there because when I try to open the file using the exact copied and pasted path, it works. I also know the application is using the right directory because, well, it outputs it in the error.


Solution

  • Tilde expansion is a shell thing. Write the proper pathname (probably /home/yourusername/Desktop/etcetcetc) or use
    process.env.HOME + '/Desktop/blahblahblah'