Node.js/Express.js App Only Works on Port 3000

后端 未结 16 2253
暖寄归人
暖寄归人 2020-12-12 13:23

I have a Node.js/Express.js app running on my server that only works on port 3000 and I\'m trying to figure out why. Here\'s what I\'ve found:

  • Without specifyi
16条回答
  •  南笙
    南笙 (楼主)
    2020-12-12 13:51

    The line you found just looks for the environmental variable PORT, if it's defined it uses it, otherwise uses the default port 3000. You have to define this environmental variable first (no need to be root)

    export PORT=8080
    node 
    

提交回复
热议问题