NodeJS accessing file with relative path [duplicate]
问题 This question already has answers here : Proper way to reference files relative to application root in Node.JS (3 answers) Closed 2 years ago . It seemed like a straight forward problem. But I amn't able to crack this. Within helper1.js I would like to access foobar.json (from config/dev/ ) root -config --dev ---foobar.json -helpers --helper1.js I couldn't get this to work fs: how do I locate a parent folder? Any help here would be great. 回答1: You can use the path module to join the path of