我的當前目錄的工作是__dirname不節點JS用的WebPack捆綁
D:\bkp\Programming\TestWorks\nodejs\testApp
,但是當我使用__dirname
並試圖顯示與快遞服務器上的文件它給了我這個錯誤
Error: ENOENT: no such file or directory, stat 'D:\views\index.html'
我的代碼是
res.sendFile(__dirname + 'views/index.html');
當我使用webpack捆綁它並運行外圍le文件然後發生這種情況。否則,如果我只是運行正常的app.js文件,它工作正常。幫助將不勝感激。