当前位置: 首页 > news >正文

石家庄网站设计建设公司网站建设具体实施方案

石家庄网站设计建设,公司网站建设具体实施方案,微商城怎么弄,建设银行温州分行网站Next.js的默认访问端口是3000。有时环境需要更改。 方法1 通过环境变量 此方法不能改变端口#xff0c;看方法2 点击查看官方文档 Next.js will automatically expand variables that use $ to reference other variables e.g. $VARIABLE inside of your .env* files. This …Next.js的默认访问端口是3000。有时环境需要更改。 方法1 通过环境变量 此方法不能改变端口看方法2 点击查看官方文档 Next.js will automatically expand variables that use $ to reference other variables e.g. $VARIABLE inside of your .env* files. This allows you to reference other secrets. 翻译Next.js 将自动展开使用 $ 引用其他变量的变量例如在您的 .env* 文件中的 $VARIABLE。这使您能够引用其他密钥。 意思是说Next.js会加载.env*文件中的变量。注意*是统配符也就是.env开头的文件中的变量都会加载。 官方文档还说 Default Environment Variables In general only one .env.local file is needed. However, sometimes you might want to add some defaults for the development (next dev) or production (next start) environment. Next.js allows you to set defaults in .env (all environments), .env.development (development environment), and .env.production (production environment). .env.local always overrides the defaults set. Good to know: .env, .env.development, and .env.production files should be included in your repository as they define defaults. .env*.local should be added to .gitignore, as those files are intended to be ignored. .env.local is where secrets can be stored. 翻译 默认环境变量 通常只需要一个 .env.local 文件。然而有时您可能希望为开发next dev或生产next start环境添加一些默认值。 Next.js 允许您在 .env所有环境、.env.development开发环境和 .env.production生产环境中设置默认值。 .env.local 总是覆盖设置的默认值。 需要注意的是.env、.env.development 和 .env.production 文件应包含在您的存储库中因为它们定义了默认值。.env*.local 应该添加到 .gitignore 中因为这些文件应该被忽略。.env.local 是用于存储机密信息的地方。 再看官方文档 Environment Variable Load Order Environment variables are looked up in the following places, in order, stopping once the variable is found. process.env.env.$(NODE_ENV).local.env.local (Not checked when NODE_ENV is test.).env.$(NODE_ENV).env For example, if NODE_ENV is development and you define a variable in both .env.development.local and .env, the value in .env.development.local will be used. Good to know: The allowed values for NODE_ENV are production, development and test. 翻译 环境变量加载顺序 环境变量按照以下顺序查找一旦找到变量就停止。 process.env.env.$(NODE_ENV).local.env.local当 NODE_ENV 为 test 时不会被检查env.$(NODE_ENV)env 例如如果 NODE_ENV 为 development并且您在 .env.development.local 和 .env 中都定义了一个变量那么将使用 .env.development.local 中的值。 需要知道的是NODE_ENV 允许的值为 production、development 和 test。 举例 .env.local文件中写 PORT8088方法2 命令行 官方文档 Production next start starts the application in production mode. The application should be compiled with next build first. The application will start at http://localhost:3000 by default. The default port can be changed with -p, like so: 生产环境 next start 以生产模式启动应用程序。首先应用程序应该使用 next build 进行编译。 应用程序默认将在 http://localhost:3000 上启动。默认端口可以使用 -p 参数进行更改例如 npx next start -p 4000Or using the PORT environment variable: 或者使用 PORT 环境变量 PORT4000 npx next startGood to know: -PORT cannot be set in .env as booting up the HTTP server happens before any other code is initialized. next start cannot be used with output: ‘standalone’ or output: ‘export’. 需要知道的是 PORT 不能在 .env 中设置因为启动 HTTP 服务器会在初始化任何其他代码之前发生。 next start 不能与 output: ‘standalone’ 或 output: ‘export’ 一起使用。 一般是写在package.json文件中例如 { ....scripts: {dev: PORT3001 next dev, #开发端口是3001start: next start -p 3002, #生成端口是3002}, ... }
http://www.yutouwan.com/news/259702/

相关文章:

  • 文网文网站建设无锡营销型网站价格
  • 学网站建设多少钱深圳模具外贸网站建设
  • 江桥做网站山西大同专业网站建设制作价格
  • 山西网站建设适合v加xtdseo自己做网站销售
  • 光明网站开发dede5.7微电影网站模板
  • jsp购物网站开发环境好用的微信公众号编辑器
  • 让别人做一个网站需要多少钱企业网站 优秀
  • 涂料网站建设crm软件免费
  • 做网站详细教程有做销售产品的网站
  • 找人做淘宝网站多少钱php网站开发书
  • 云南省人防工程建设网站电子商务网站建设实验报告心得
  • 深圳网站seo优化公司淘宝客网站html
  • 适合做外链的网站wordpress 主题语言
  • 东莞建设网站和田网页设计
  • 沈阳个人做网站正邦 网站建设
  • 滁州网站建设信息推荐网站免费网站免费优化优化
  • 建网站 域名 空间门户网站开发案例
  • 织梦网站分享插件资阳网站优化
  • 简述建设一个网站的步骤怎么做游戏推广赚钱
  • 检测asp网站死循环创建网页快捷键
  • python创建网站建行信用卡网站登录
  • 四川网站建设博客如何用dw8做网站视频
  • 网站名是域名吗个人网站建设研究意义
  • 医疗器械网站怎么做最新wordpress漏洞
  • 晚上睡不着网站2021免费一个很好的个人网站开发
  • 南宁哪些公司专业做网站完整开发网站需要什么
  • 唯品会 一家专门做特卖的网站深圳seo教程
  • 网站建设名字推介网足球二手料
  • 做房产抵押网站需要什么手续深圳市建设行业门户网站
  • 校友网站 建设php个人网站源码