ENOENT, no such file or directory

前端 未结 10 1908
萌比男神i
萌比男神i 2020-12-04 23:39

I\'m getting this error from my node app:

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

I know

10条回答
  •  春和景丽
    2020-12-05 00:13

    __dirname 
    

    Gives you the current node application's rooth directory.

    In your case, you'd use

    __dirname + '/Desktop/MyApp/newversion/partials/navigation.jade';
    

    See this answer:

    App base path from a module in NodeJS

提交回复
热议问题