reactjs - 如何更改反应应用程序中的默认端口并为其定义特定端口
问题描述
React 应用程序获得了端口 8080,目前我们无法使用。
如何更改默认端口号。
这是运行命令 npm start 时显示的错误
**注意:也许这可能是一个不同的问题,对反应开发有点新
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EACCES 127.0.0.1:8080
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1350:19)
at listenInCluster (net.js:1408:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1517:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! redux-simple-starter@1.0.0 start: `node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the redux-simple-starter@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\harsha94\AppData\Roaming\npm-cache\_logs\2019-05-25T16_59_11_280Z-debug.log ```
解决方案
在您的 package.json 文件中添加以下行
"scripts": { "start": "PORT=5600 react-scripts start",
npm 安装
- npm 开始
推荐阅读
- google-colaboratory - 在 Google Colab 中,当使用 wget 命令将文件从外部站点加载到 Google Drive 目录时,它会使用我的互联网还是 Colab 的互联网?
- ios - 组合 2 个音频文件是 Swift
- python - Python 在读取文本文件时将 \n 更改为 \\n
- ios - Firebase Analytics 跟踪点击次数
- ios - 在Objective C中检查isKindOfClass是否多余?
- javascript - 我似乎无法解决此错误。HTML/JS
- sql - 在 SQL 中使用 Have 但没有得到任何结果
- javascript - 如何在javascript中使用具有相同名称值的不同对象来解构数组?
- android - 如果我的 uri 以“content://com.google.android.apps”开头,我如何从中获取位图
- angular - Anychart.js 动态显示数据