請教: Cannot find module '[object Object]'。
发布于 9小时前 作者 antelopehi 77 次浏览 来自 问答

我在練習Orelly ‘網頁應用程式應用,使用NODE和Express’ 一書 發生一個錯誤 Express started on http://localhost:3000;press Ctrl-C to terminate. Error: Cannot find module '[object Object]' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17) at require (module.js:384:17) at new View (/Users/antelopehi/Google 雲端硬碟/nodeExpress/projects/meadowlark/site/node_modules/express/lib/view.js:78:30) at EventEmitter.render (/Users/antelopehi/Google 雲端硬碟/nodeExpress/projects/meadowlark/site/node_modules/express/lib/application.js:569:12) at ServerResponse.render (/Users/antelopehi/Google 雲端硬碟/nodeExpress/projects/meadowlark/site/node_modules/express/lib/response.js:961:7) at /Users/antelopehi/Google 雲端硬碟/nodeExpress/projects/meadowlark/site/meadowlark.js:20:9 at Layer.handle [as handle_request] (/Users/antelopehi/Google 雲端硬碟/nodeExpress/projects/meadowlark/site/node_modules/express/lib/router/layer.js:95:5) at next (/Users/antelopehi/Google 雲端硬碟/nodeExpress/projects/meadowlark/site/node_modules/express/lib/router/route.js:131:13) 附上圖片程式碼。 nodejs問題.png app.get('/’, function(req, res) { res.render(‘home’); }); 可能是render這邊有狀況。請求大神幫忙解決。

2 回复

app.set('view engine', 'handlebars');

express v4? api的语法是: set('view engine', 'string here'). 所以, 用app.set('view engine', 'handlebars')试试 楼上已答, 重复了

回到顶部