首页 > 解决方案 > 如何在 next.js 中设置端口

问题描述

一个应用程序在端口 3000 上运行,我想在默认端口的不同端口上运行另一个应用程序。我如何在 React Next.js 中改变它。我的package.js脚本是

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "next",
    "build": "next build",
    "start": "next start"
  },

并且启动脚本命令是 npm run dev

标签: javascriptreactjsnpmportnext.js

解决方案


这对我有用

 "scripts": { 
       "dev": "next -p 8080" 
},

推荐阅读