如何獲取當前Node.js對應的process.env值
為什么是undefined。。
怎么設置
set process.env = ""
參考1:https://www.cnblogs.com/zdz8207/p/nodejs-process-env.html
nodejs pm2 json配置apps:https://www.jianshu.com/p/58197cb2de71
pm2安裝與使用(生產環境部署):https://www.jianshu.com/p/58197cb2de71
pm2 啟動服務閃現CMD窗口:https://ask.csdn.net/questions/753104
pm2 start pm2.json和pm2 start server.js
查看error.log發現:
Error: bind EADDRINUSE null:14999 at listenOnMasterHandle (net.js:1385:18) at shared (internal/cluster/child.js:126:3) at Worker.<anonymous> (internal/cluster/child.js:97:7) at process.onInternalMessage (internal/cluster/utils.js:47:8) at process.emit (events.js:326:22) at emit (internal/child_process.js:902:12) at processTicksAndRejections (internal/process/task_queues.js:81:21) Error: bind EADDRINUSE null:14999 at listenOnMasterHandle (net.js:1385:18) at shared (internal/cluster/child.js:126:3) at Worker.<anonymous> (internal/cluster/child.js:97:7) at process.onInternalMessage (internal/cluster/utils.js:47:8) at process.emit (events.js:326:22) at emit (internal/child_process.js:902:12) at processTicksAndRejections (internal/process/task_queues.js:81:21) Error: bind EADDRINUSE null:14999 at listenOnMasterHandle (net.js:1385:18) at shared (internal/cluster/child.js:126:3) at Worker.<anonymous> (internal/cluster/child.js:97:7) at process.onInternalMessage (internal/cluster/utils.js:47:8) at process.emit (events.js:326:22) at emit (internal/child_process.js:902:12) at processTicksAndRejections (internal/process/task_queues.js:81:21) Error: bind EADDRINUSE null:14999 at listenOnMasterHandle (net.js:1385:18) at shared (internal/cluster/child.js:126:3) at Worker.<anonymous> (internal/cluster/child.js:97:7) at process.onInternalMessage (internal/cluster/utils.js:47:8) at process.emit (events.js:326:22) at emit (internal/child_process.js:902:12) at processTicksAndRejections (internal/process/task_queues.js:81:21)
pm2 服務崩潰 Error: bind EADDRINUSE:https://www.cnblogs.com/williamjie/p/9473331.html
14999正在被占用??
Error: Redis connection to 192.168.1.3:6379 failed - connect ECONNREFUSED 192.168.1.3:6379 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) Error: Redis connection to 192.168.1.3:6379 failed - connect ECONNREFUSED 192.168.1.3:6379 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) Error: Redis connection to 192.168.1.3:6379 failed - connect ECONNREFUSED 192.168.1.3:6379 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) Error: Redis connection to 192.168.1.3:6379 failed - connect ECONNREFUSED 192.168.1.3:6379 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) Error: Redis connection to 192.168.1.3:6379 failed - connect ECONNREFUSED 192.168.1.3:6379 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
redis啟動了,但是卻一直連接失敗。。。難道是密碼??
把192.168.1.3變成127.0.0.1就好了
然后使用postman查詢接口,報錯
You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection: Error: connect ECONNREFUSED 127.0.0.1:5672 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)