- 寫好nodeJs 後啟動 --inspect 指令

node --inspect ./src/index.js
複製程式碼
或者
node --inspect=[0.0.0.0:1234] ./src/index.js
複製程式碼
- chrome 訪問node 監聽埠,並在另一個tab 開啟
chrome://inspect/

- 點選那個inspect 就可以看到node 的日誌了。方便開發與除錯

- 出於安全性,除錯之後,記得關掉除錯
node --inspect ./src/index.js
複製程式碼
或者
node --inspect=[0.0.0.0:1234] ./src/index.js
複製程式碼
chrome://inspect/