2015年11月3日 星期二

AWS node.js bug 502 Bad Gateway nginx/


每次看到這個 502 Bad Gateway  

真的很另人氣結
因為nginx把所有錯誤所攬了,
真是另人吐血
https://forums.aws.amazon.com/thread.jspa?messageID=639797

I've encountered this problem repeatedly a couple of times so here is a checklist I find useful:

1. Is your app run by 'node' or 'nodemon'? If it's nodemon, modify the package.json and use node instead.
2. Is your main app file named 'app.js'? If yes, change it to a different name [1]
3. Have updated your package.json file with modules that you recently locally installed (npm install )?

Feel free to push more items to it.


最近抓502心得  
package.json裡
 "dependencies": 這個是一定要安裝,通常是Serve r端一定要用到的 例如 express ... <-- aws="" ec2="" font="">

"devDependencies":這個通常是開發用的元件,例如 webpack... 

有時候沒注意到,把放dependencies的丟到devDependencies裡,結果就很長發生本機可以,但丟到aws上就不行了。