【发布时间】:2020-01-29 05:27:40
【问题描述】:
我需要在端口 1234 上运行我的 ReactJS 应用程序,但是当我运行 yarn dev 时,我得到以下信息:
$ parcel src/index.html --port 1234
在http://localhost:2493 运行的服务器 - 无法使用配置的端口 1234。
√ 内置 11.45 秒。
它没有告诉我为什么它不能在端口1234 上运行,所以我怀疑该端口可能已经在使用中。根据this answer,下面应该告诉我哪个进程正在使用该端口。
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
但这并没有帮助,它给出了以下消息:
Get-NetTCPConnection:没有找到属性“LocalPort”等于“1234”的 MSFT_NetTCPConnection 对象。验证属性的值并重试。
我猜这意味着没有进程绑定到端口1234。但是如果是这样的话,为什么我不能绑定到那个端口呢?
我的package.json如下:
{
"name": "bejebeje.react",
"version": "1.0.0",
"description": "bejebeje's react-js frontend",
"main": "index.js",
"repository": "git@github.com:JwanKhalaf/Bejebeje.React.git",
"author": "John",
"license": "GPL-3.0",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.19",
"@fortawesome/free-brands-svg-icons": "^5.9.0",
"@fortawesome/free-solid-svg-icons": "^5.9.0",
"@fortawesome/pro-light-svg-icons": "^5.9.0",
"@fortawesome/pro-regular-svg-icons": "^5.9.0",
"@fortawesome/pro-solid-svg-icons": "^5.9.0",
"@fortawesome/react-fontawesome": "^0.1.4",
"@reach/router": "^1.2.1",
"oidc-client": "^1.8.2",
"react": ">=16",
"react-dom": "^0.14.9 || ^15.3.0 || ^16.0.0-rc || ^16.0",
"react-icons": "^3.7.0",
"styled-components": "^4.3.2"
},
"scripts": {
"dev": "parcel src/index.html --port 1234",
"build": "parcel build src/index.html"
},
"devDependencies": {
"@fortawesome/fontawesome-pro": "^5.9.0",
"axios": "^0.19.0",
"parcel-bundler": "^1.12.3",
"prettier": "^1.16.4",
"sass": "^1.22.5"
}
}
【问题讨论】:
-
你的机器上有 VLC 媒体播放器吗?
-
嗯,我知道,你为什么这么问?
标签: parceljs