亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在Linux上同時執行多個npm自定義的命令,兩個命令都是啟動Node站點。并且在后臺運行

在Linux上同時執行多個npm自定義的命令,兩個命令都是啟動Node站點。并且在后臺運行

冉冉說 2019-05-13 07:56:06
"start-client":"cross-envNODE_ENV=productionnode./server/index.js","start-api":"cross-envNODE_ENV=productionnode./server/api/index.js","start-pro":"concurrently\"npmrunstart-client\"\"npmrunstart-api\""以上的npmrunstart-pro在linux上直接運行是可以跑起來的,但是關掉當前會話之后服務就存在了也就關閉了。當我執行npmrunstart-pro&這個命令的時候,也正常的跑起來了,當我關閉會話之后,站點出現了503的錯誤,使用lsof-i:8080和lsof-i:8686查看端口是否存在,發現8080的端口不存在,但是8686的后端端口還存在。然后就放棄了這種操作。當我執行nohupnpmrunstart-pro&這個命令的時候,在項目的根目錄出現了nohup.output的文件,里面記錄了錯誤:>[email protected]/website/pgyer>concurrently"npmrunstart-client""npmrunstart-api"events.js:160thrower;//Unhandled'error'event^Error:EBADF:badfiledescriptor,readatError(native)[email protected]:`concurrently"npmrunstart-client""npmrunstart-api"`npmERR!Exitstatus1npmERR!npmERR!Failedatthep2@0.1.0start-proscript.npmERR!Thisisprobablynotaproblemwithnpm.Thereislikelyadditionalloggingoutputabove.npmERR!Acompletelogofthisruncanbefoundin:npmERR!/root/.npm/_logs/2018-07-18T00_30_14_968Z-debug.log再次想辦法,使用先執行nohupnpmrunstart-api&提示成功!在執行nobupnpmrunstart-client&也執行成功!本人比較強迫癥,在這里想問一下,如何能一條命令一下執行npmrunstart-api和npmrunstart-client有什么方法嗎?
查看完整描述

2 回答

?
眼眸繁星

TA貢獻1873條經驗 獲得超9個贊

//package.json
"script":{
"start-client":"cross-envNODE_ENV=productionnode./server/index.js",
"start-api":"cross-envNODE_ENV=productionnode./server/api/index.js",
"start-all":"npmrunstart-client&&npmrunstart-api"
}
npmrunstart-all
                            
查看完整回答
反對 回復 2019-05-13
  • 2 回答
  • 0 關注
  • 1502 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號