简体   繁体   English

Ionic2-LiveReload无法正常工作

[英]Ionic2 - LiveReload not working

I'm trying to run a brand new Ionic2 application on my Android device with --livereload option but I'm getting errors. 我正在尝试使用--livereload选项在我的Android设备上运行全新的Ionic2应用程序,但出现错误。

Setup commands: 设置命令:

$ ionic start ionic2-speed-test-run --v2
$ cd ionic2-speed-test-run/
$ cordova platform add android

If I do: 如果我做:

$ ionic run android

The application runs properly on my Android device, but if I do: 该应用程序可以在我的Android设备上正常运行,但是如果这样做:

$ ionic run android -l

Then I get the followin error output: 然后我得到跟随错误输出:

$ ionic run android -l

> ionic-hello-world@0.0.0 ionic:serve D:\ionic2\ionic2-speed-test-run
> ionic-app-scripts serve "--v2" "--runLivereload" "--isPlatformServe" "--livereload" "--port" "8101" "--livereload-port" "35730" "--address" "192.168.1.202" "--iscordovaserve" "--nobrowser"

[17:37:09]  ionic-app-scripts 1.3.0
[17:37:09]  watch started ...
[17:37:09]  build dev started ...
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE 0.0.0.0:53703
    at Object.exports._errnoException (util.js:1018:11)
    at exports._exceptionWithHostPort (util.js:1041:20)
    at Server._listen2 (net.js:1262:14)
    at listen (net.js:1298:10)
    at net.js:1408:9
    at _combinedTickCallback (internal/process/next_tick.js:83:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:393:7)
    at startup (bootstrap_node.js:150:9)

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ionic:serve" "--" "--v2" "--runLivereload" "--isPlatformServe" "--livereload" "--port" "8101" "--livereload-port" "35730" "--address" "192.168.1.202" "--iscordovaserve" "--nobrowser"
npm ERR! node v6.10.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@0.0.0 ionic:serve: `ionic-app-scripts serve "--v2" "--runLivereload" "--isPlatformServe" "--livereload" "--port" "8101" "--livereload-port" "35730" "--address" "192.168.1.202" "--iscordovaserve" "--nobrowser"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world@0.0.0 ionic:serve script 'ionic-app-scripts serve "--v2" "--runLivereload" "--isPlatformServe" "--livereload" "--port" "8101" "--livereload-port" "35730" "--address" "192.168.1.202" "--iscordovaserve" "--nobrowser"'.
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 "--v2" "--runLivereload" "--isPlatformServe" "--livereload" "--port" "8101" "--livereload-port" "35730" "--address" "192.168.1.202" "--iscordovaserve" "--nobrowser"
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!     D:\ionic2\ionic2-speed-test-run\npm-debug.log

Just in case, environment info here: 以防万一,这里的环境信息:

$ ionic info

Your system information:
Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.2
Xcode version: Not installed

Any idea on how to make the --livereload works? 关于如何使--livereload工作的任何想法吗?

This type of error happens when you are already using live-loading with same ip address. 当您已经使用具有相同IP地址的实时加载时,会发生此类错误。 just kill other running ionic apps and try your luck. 只需杀死其他正在运行的离子应用程序,然后试试运气即可。

if you still get this error just restart system and try it again. 如果仍然出现此错误,请重新启动系统 ,然后重试。

last but least 最后但最少

upgraded my cordova and ionic to latest versions then its working great. 将我的cordova和ionic升级到最新版本,然后运行良好。 just treat it as last hope. 只是把它当作最后的希望。

i have used last option for my ionic app. 我已经为我的离子应用程序使用了最后一个选项。

This message happen when live reload url already in use. 当实时重载URL已在使用中时,会发生此消息。 Might be you are running $ ionic serve command and try to $ ionic run android -l Close all running program and try again. 可能是您正在运行$ ionic serve命令,并尝试$ ionic run android -l关闭所有正在运行的程序,然后重试。 If problem not resolve, try with restart you system. 如果问题仍未解决,请尝试重新启动系统。 It will forcefully close your all application. 它将强制关闭所有应用程序。 You may try with downgrade Ionic to version 2. 您可以尝试将Ionic降级到版本2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM