当我尝试运行一个简单的打印常见的“Hello World”程序时,出现了以下错误代码。
app.set('port', port);
^
TypeError: app.set is not a function
at Object.<anonymous> (/home/xpuser/Desktop/Nodetest/bin/www:16:5)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3
写下 "module.exports = app;" 后出现了以下错误:
module.exports = app;
^
ReferenceError: app is not defined
at Object. <anonymous> (/home/xpuser/Desktop/Nodetest/app.js:23:18)
at Module._compile (module.js: 409: 26)
at Object.Module._extensions..js (module.js: 416: 10)
at Module.Load (module.js: 343: 32)
at Function.Module._load (module.js: 300: 12)
at Module.require (module.js: 353: 17)
at require (internal / module.js: 12: 17)
at Object. <anonymous> (/ home / xpuser / Desktop / Nodetest / bin / www: 7: 11)
at Module._compile (module.js: 409: 26)
at Object.Module._extensions..js (module.js: 416: 10)
app
? - Rayon