【问题标题】:Ports 49918 is already in use端口 49918 已在使用中
【发布时间】:2019-05-21 19:21:49
【问题描述】:

我正在运行的登录页面托管在端口 49918 上,我无法使用其他端口。应用程序可在 4200 等其他端口范围内运行。

尝试全局安装 Angular cli

netstat -ano | findStr :49918

Dev: {
    authority: 'https://dev-im.com',
    client_id: 'APC',
    redirect_uri: window.location.origin + '/oidclogin',
    silent_redirect_uri: window.location.origin + '/oidcrenew',
    post_logout_redirect_uri: window.location.origin + '/oidclogout',
    response_type: 'code id_token token',
    scope: 'openid email profile api1 offline_access',
    filterProtocolClaims: true,
    loadUserInfo: true,
    automaticSilentRenew: false,
    monitorSession: true
  }

我的 Angular 应用程序必须在登录后在本地运行

【问题讨论】:

  • 我创建了新的 Angular 应用程序。当我运行ng serve --o --port 49918。它给了我这个错误。 **监听 EACCES:权限被拒绝 **127.0.0.1:49918 错误:监听 EACCES:权限被拒绝 127.0.0.1:49918 在 Server.setupListenHandle [as _listen2] (net.js:1253:19)在 ListenInCluster (net.js:1318:12) 在 GetAddrInfoReqWrap.doListen [作为回调] (net.js:1451:7) 在 GetAddrInfoReqWrap.onlookup [作为 oncomplete] (dns.js:61:10)

标签: angular angular-cli


【解决方案1】:

如果你使用ng serve,Angular Live 开发服务器正在监听 localhost:4200,你可以在 http://localhost:4200/ 上打开浏览器

如果你想自动打开它,你可以使用ng serve --o

&如果你想改变端口你可以使用ng serve --o --port 4220打开 http://localhost:4220/

你可以用你不使用的端口替换4220

【讨论】:

    【解决方案2】:

    即使全局 Angular CLI 版本高于 Angular 应用的本地版本,您的 Angular 应用也能正常运行。

    是的,在windows中很难找到监听端口的已经死掉的进程,但也不是不可能。

    您可以使用 Windows 资源管理器找出这个监听端口。

    Start >> All Programs >> Accessories >> System Tools >> Resource Monitor

    运行(Win + r) 输入resmon.exe 然后按Enter

    寻找网络标签

    搜索您的端口号并找到它的 PID。

    使用任务管理器或使用以下命令杀死具有该 PID 的进程

    taskkill /F /PID pid_number

    就是这样!

    现在尝试再次运行您的 Angular 应用程序。

    【讨论】:

    • 端口 49918 在 resmon.exe 中不可用。我也下载了currports软件。没有端口 49918 可供我杀死 PID。
    【解决方案3】:

    在那种情况下你可以做这些事情:

    您要设置另一个端口:ng serve --o --port 1234

    你可以这样做:

    打开命令提示符并输入:netstat -a -o -n

    找到你想杀死的进程的PID。

    输入:taskkill /F /PID 49918

    这个 49918 - 是我们想要杀死然后重新启动的进程的 PID。检查附件。

    【讨论】:

    • 已经有问题表明 Abrar 不能使用另一个端口,netstat -a -o -n 也返回了空结果。
    猜你喜欢
    • 2021-09-12
    • 1970-01-01
    • 2016-08-07
    • 2018-01-13
    • 1970-01-01
    • 2021-07-16
    • 2017-05-23
    • 2017-09-18
    • 2019-09-01
    相关资源
    最近更新 更多