如何在 next.js 中设置端口 [英] How to Set port in next.js

查看:25
本文介绍了如何在 next.js 中设置端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

one application is running on port 3000 and I want to run another application on a different port of the default port. How I change this in React Next.js. My package.js script is

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

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

推荐答案

这项工作适合我

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

这篇关于如何在 next.js 中设置端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆