Cannot run "ionic lab"

时间:2019-01-15 18:29:25

标签: node.js ionic-framework

I cannot run the command ionic lab or ionic serve -l because I get the error: listen EACCES 127.0.0.1:8200

I've run:

npm install -g ionic cordova
ionic start myIonicApp blank
cd myIonicApp 
npm i -D -E @ionic/lab
ionic lab

Then the error occurs:

ionic-lab http://localhost:8100 --host localhost --port 8200 --project-type ionic-angular --app-name myIonicApp --app-version 0.0.1

events.js:183
      throw er; // Unhandled 'error' event
      ^
> Error: listen EACCES 127.0.0.1:8200
>      at Server.setupListenHandle [as _listen2] (net.js:1343:19)
>      at listenInCluster (net.js:1401:12)    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1510:7)
>      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:72:10)

Versions:

Node: v8.12.0

Ionic CLI: 4.8.0

Cordova: 8.1.2 (cordova-lib@8.1.1)

I've also tried to change the port with this command: ionic serve -l -p 27222 but the error "Error: listen EACCES 127.0.0.1:8200" continues.

When I run "netstat" it shows that a proccess svchost.exe is listening on port 8200. The proccess id corresponds to "System" proccess ("NT Kernel and System")

Anyone knows what may be happening?

3 个答案:

答案 0 :(得分:1)

您还可以在server.js和serve.d.ts中更改DEFAULT_LAB_PORT的值 按照步骤查找在哪里更改端口

步骤1:获取用于此用途的离子的位置
对于Windows,请使用 where ionic
对于Linux,请使用whereis ionic
它应该显示您的全局npm文件夹(如果已全局安装)

D:\Users>where ionic
D:\Users\<username>\AppData\Roaming\npm\ionic
D:\Users\<username>\AppData\Roaming\npm\ionic.cmd



步骤2:打开ionic.cmd(适用于Windows)并搜索类似内容

"%_prog%"  "%dp0%\node_modules\@ionic\cli\bin\ionic" %* 



步骤3:现在转到上面给出的@ionic\cli目录,然后打开./lib/sereve.js更改const DEFAULT_LAB_PORT = 8202或按您的需要端口



步骤4:现在在同一目录中打开./lib/sereve.d.ts更改const DEFAULT_LAB_PORT = 8202或通过您所需的端口



步骤5:使用ionic serve --lab

运行您的应用程序


您的应用程序将在新端口上运行

答案 1 :(得分:0)

该版本昨天才发布。您可以检查几件事:

  • 手动删除所有正在运行的离子过程,然后重试。
  • 杀死任何打开了8200端口的进程,或使用其他端口号启动所有进程。
  • 在Ionic外部使用Angular运行:ng服务
  • 使用实时服务器:npm install -g实时服务器&& ionic build &&实时服务器
  • 降级到4.7.1甚至3.20.0版本(不是最佳选择)
  • 将您的节点升级到10+ LTS

答案 2 :(得分:0)

问题是我的本地IIS。它有一个在端口8200上运行的应用程序。