2016-11-16 76 views
0

林與ionic2工作。以下是ionic info生成的所有信息。我基本上在兩個不同的離子項目上工作,我想同時爲他們提供兩個項目。在執行ionic serve時,默認情況下,一個項目在端口8000上加載。我試圖通過使用ionic serve --port 8101來更改第二個端口。但是這並不能啓動第二個項目。廣東話運行離子在多個項目中擔任

這是以下錯誤:

> [email protected] ionic:serve /Users/vramos/Workspace/visitorapp 
> ionic-app-scripts serve "--port" "8100" 

[21:34:57] ionic-app-scripts 0.0.44 
[21:34:57] watch started ... 
[21:34:57] build dev started ... 
[21:34:57] clean started ... 
[21:34:57] clean finished in less than 1 ms 
[21:34:57] copy started ... 
[21:34:57] transpile started ... 
events.js:160 
     throw er; // Unhandled 'error' event 
    ^

Error: listen EADDRINUSE 0.0.0.0:53703 
    at Object.exports._errnoException (util.js:1007:11) 
    at exports._exceptionWithHostPort (util.js:1030:20) 
    at Server._listen2 (net.js:1253:14) 
    at listen (net.js:1289:10) 
    at net.js:1399:9 
    at _combinedTickCallback (internal/process/next_tick.js:77:11) 
    at process._tickCallback (internal/process/next_tick.js:98:9) 
    at Module.runMain (module.js:577:11) 
    at run (node.js:348:7) 
    at startup (node.js:140:9) 

npm ERR! Darwin 15.6.0 
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" 
    "ionic:serve" "--" "--port" "8100" 
npm ERR! node v6.2.2 
npm ERR! npm v3.9.5 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] ionic:serve: `ionic-app-scripts serve " 
-- port" "8100"` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] ionic:serve script 'ionic- 
app- scripts serve "--port" "8100"'. 
npm ERR! Make sure you have the latest version of node.js and 
npm installed. 
npm ERR! If you do, this is most likely a problem with the 
ionic-hello- world package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  ionic-app-scripts serve "--port" "8100" 
npm ERR! You can get information on how to open an issue for 
this project with: 
npm ERR!  npm bugs ionic-hello-world 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls ionic-hello-world 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /Users/vramos/Workspace/visitorapp/npm-debug.log 
There was an error serving your Ionic application: There was 
    an error with the spawned command: serve 

ionic info

編輯(2016年11月16日):因此,與ionic serve --port 3000 --dev-log-server 8101運行第二個項目的工作。儘管如此,我仍然在終端出現錯誤,只是fyi。

enter image description here

回答

1

的錯誤是

Error: listen EADDRINUSE 0.0.0.0:53703

所以在某些時候離子試圖使用端口53703,這是不可用的。

$ grep -rns 53703 * 
node_modules/@ionic/app-scripts/dist/dev-server/dev-server.js:104:var DEV_LOGGER_DEFAULT_PORT = 53703; 

當我運行的離子兩個實例,你有,沒有在我的系統使用端口53703.

話雖這麼說,我跑離子-APP-腳本0.0.39,這是版本附帶rc2教程。

幾個選項:

  • 嘗試通過另一種開發記錄器端口(通過--dev-logger-port
  • 使用lsof找出什麼是保持口53703,殺死該進程(lsof | grep 53703
  • 嘗試降級ionic-app-scripts0.0.39
3

我面臨同樣的問題。

後發現了一個小挖的是35729端口被livereload端口和35703端口dev所記錄器端口。

運行問題解決了: 離子服務--port 8081 --livereload端口35730 --dev記錄器端口53704