app.set('port', port) 'TypeError: undefined is not a function'. Beginner, need ideas

后端 未结 6 939
春和景丽
春和景丽 2021-02-04 04:12

I\'m an amateur learning to build with node.js. I\'ve been following a tutorial to create my first node.js app. It worked perfectly until I entered \'npm start\'. The log is:

6条回答
  •  深忆病人
    2021-02-04 05:09

    You are not exporting anything in the app.js file. At the end of app.js file, include following line.

    module.exports = app;
    

    See whether your problem goes away.

    And one more addition: you have var app = express(); twice in your app.js.

提交回复
热议问题