2013-12-24 62 views
17

我碰到我节点应用此错误:ENOENT,没有这样的文件或目录

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

我知道这个文件是存在的,因为当我尝试打开使用精确复制和粘贴路径的文件,有用。 我也知道应用程序正在使用正确的目录,因为它输出错误。

回答

10

蒂尔德扩张是一个壳事情。写正确的路径名(可能/home/ yourusername /Desktop/etcetcetc),或使用
process.env.HOME + '/Desktop/blahblahblah'

+0

嗯,我认为这是由 'app.locals.basedir = '〜/桌面/ BitBox/thenewbox' 办理;' 我试图 'app.set( '家',process.env。 HOME || '/ Users/Kinnard/Desktop/BitBox/thenewbox');' 但是,这并没有工作,同样的错误。 –

+0

好吧,只需将'app.locals.basedir ='〜/ Desktop/BitBox/thenewbox';'改为绝对路径。谢谢! –

+0

这也让我感到:D – blong

15

我相信以前的答案是正确的回答这个问题,但我得到这个错误,当我尝试安装NPM包(见下文):

enter image description here

对我来说,修复是:npm init --yes

enter image description here

相关问题