windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

How to run Next Js application build (out) directory?

Asked By: Anonymous

I have done development of Next Js application and as of now I have done auto deployment using vercel

Things are fine as of now.. But here came the requirement that I need to build the Next Js application and share the build folder with the team for deployment in server.

The commands I have followed,

npm run build &
npm run export

And the above one creates the out directory.. So how to run this out directory in my local machine to check whether the build folder is working as expected before sharing with the team?

Folder structure of out directory:

 -> out

      -> _next
             -> static
             -> xxxxxxxxxxxxx (some random name)
      -> static
      -> home.png
      -> location.png

So anyone could kindly please help me how can I run this generated build folder (out) to check whether the developed Next Js application works fine in my local machine after which I can share the same build folder to the team?

To be specific I would like to know how exactly I can build the next js application in my local and then to test that built folder in my local that will run the application and can share the working build to anyone in team.

Raised issue here but that didn’t help in anyway..


Answered By: Anonymous

The official Next static export example uses serve, to "serve" the out directory. Since the out directory is just a bunch of static files, you need some sort of connection layer to the outside world/internal network. You could use something like nginx to the serve these assets (which eliminates the need of having to run two web servers). But, if you’re looking for an easy way to run a local staging build, then you’ll need to use some sort of web server: express, http-server or serve to name a few.

…and can share the working build to anyone in team.

If you’re remote and connecting to a WAN, then anyone from your team can visit the staging build (eg: http://wanlocalip:3000 — you can use address to print out a console message). If you’re not connecting to a WAN and if you don’t have your own server, then you’ll have to create a remote staging environment using a 3rd party service like vercel, AWS, or Digital Ocean to name a few.

With that out of the way, let’s take the official with-static-export example and set up a custom express server.

First, we’ll add a few dependencies:
yarn add chalk dotenv express

Adjust the package.json file scripts to be:

  "scripts": {
    "dev": "next",
    "export": "next build && next export",
    "start": "NODE_ENV=production node ./server.js"

Then we’ll create a server.js file in the root directory:


const dotenv = require("dotenv");
// import ENVs from ".env.local" and append to process
dotenv.config({ path: ".env.local" }); 
const express = require("express");
const address = require("address");
const chalk = require("chalk");

// create express web server instance
const app = express();
// pull out ENVs from process
const { LOCALHOST, PORT } = process.env;
// get the Local IP address
const LOCALIP = address.ip();

// tell express to serve up production assets from the out directory

// tell express to listen for incoming connections on the specified PORT
app.listen(PORT, (err) => {
  if (!err) {
    // log the LOCALHOST and LOCALIP addresses where the app is running
      `n${chalk.rgb(7, 54, 66).bgRgb(38, 139, 210)(" I ")} ${
        "Application is running at"
      )} ${chalk.rgb(235, 220, 52).bold(LOCALHOST)} ${
      )} ${chalk.rgb(235, 220, 52).bold(`http://${LOCALIP}:${PORT}`)}n`
  } else {
    console.err(`nUnable to start server: ${err}`);

Optionally we can adjust the next.config.js to display a compilation message in development:


const { DefinePlugin } = require("webpack");
const FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin");
const address = require("address");

const { LOCALHOST, NODE_ENV, PORT } = process.env;
const LOCALIP = address.ip();

const plugins = (isServer) => {
  const plugins = [];

  if (!isServer) {
      /* OPTIONAL -- append ENVS to client-side process */
      new DefinePlugin({
        "process.env": {
          LOCALHOST: JSON.stringify(LOCALHOST),
          NODE_ENV: JSON.stringify(NODE_ENV),
  } else {
     /* add console compilation messages */
      NODE_ENV === "development" &&
        new FriendlyErrorsWebpackPlugin({
          compilationSuccessInfo: {
            messages: [
              `Local development build: x1b[1m${LOCALHOST}x1b[0m`,
              LOCALIP &&
                `Remote development build: x1b[1mhttp://${LOCALIP}:${PORT}x1b[0m`,
            notes: [
              "Note that the development build is not optimized.",
              "To create a production build, use x1b[1mx1b[32myarn exportx1b[0m.n",
          clearConsole: false,

  return plugins.filter(Boolean);

module.exports = {
  webpack(config, { isServer }) {
    /* adds custom plugins to client and/or server */

    /* return new config to next */
    return config;

Now that we have everything set up, we can run yarn export to build and export the project to the out directory, then we can run a local staging environment by running yarn start. Visit one of the addresses printed in the console.


WAN (only accessible to those connected to a LAN connection within the WAN)

Click here to see a working repo example of the above.

If you’re still having trouble with your project, then please share a repository; otherwise, it’s going to be very difficult to help you troubleshoot.

techinplanet staff

instagram volgers kopen volgers kopen buy windows 10 pro buy windows 11 pro

Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno
Alanya escort Manavgat escort Fethiye escort Kemer escort Didim escort Çanakkale escort Aydın escort Muğla escort Tekirdağ escort Manisa escort Balıkesir escort Trabzon escort Elazığ escort Ordu escort Kütahya escort Isparta escort Rize escort Kahramanmaraş escort Yalova escort Giresun escort Yozgat escort Tokat escort Şanlıurfa escort Sivas escort Batman escort Erzurum escort Sinop escort Kırşehir escort Karaman escort Kırıkkale escort Bolu escort Amasya escort Niğde escort Uşak escort Edirne escort Çorum escort Osmaniye escort Zonguldak escort Van escort Erzincan escort Söke escort Bodrum escort Çerkezköy escort Akhisar escort Bandırma escort Ayvacık escort Akçaabat escort Karakoçan escort Altınordu escort Tavşanlı escort Eğirdir escort Ardeşen escort Afşin escort Altınova escort Bulancak escort Sorgun escort Erbaa escort Viranşehir escort Zara escort Kozluk escort Aziziye escort Ayancık escort Kaman escort Ermenek escort Keskin escort Gerede escort Göynücek escort Bor escort Banaz escort Havsa escort Osmancık escort Bahçe escort Alaplı escort Başkale escort Kemah escort Nazilli escort Fethiye escort Çorlu escort Alaşehir escort Altıeylül escort Biga escort Araklı escort Kovancılar escort Fatsa escort Simav escort Yalvaç escort Çayeli escort Dulkadiroğlu escort Çiftlikköy escort Espiye escort Sarıkaya escort Niksar escort Suruç escort Yıldızeli escort Sason escort Horasan escort Boyabat escort Mucur escort Sarıveliler escort Yahşihan escort Göynük escort Gümüşhacıköy escort Çamardı escort Eşme escort İpsala escort Sungurlu escort Hasanbeyli escort Çaycuma escort İpekyolu escort Refahiye escort Kuşadası escort Marmaris escort Süleymanpaşa escort Turgutlu escort Susurluk escort Gelibolu escort Of escort Ünye escort Domaniç escort Fındıklı escort Elbistan escort Çınarcık escort Tirebolu escort Akdağmadeni escort Turhal escort Eyyübiye escort Suşehri escort Yakutiye escort Gerze escort Mengen escort Merzifon escort Ulukışla escort Sivaslı escort Keşan escort Kadirli escort Ereğli escort Özalp escort Tercan escort Efeler escort Didim escort Çine escort Dalaman escort Menteşe escort Milas escort Ortaca escort Seydikemer escort Ergene escort Kapaklı escort Malkara escort Salihli escort Şehzadeler escort Soma escort Yunusemre escort Ayvalık escort Bigadiç escort Burhaniye escort Gönen escort Karesi escort Çan escort Yenice escort Ortahisar escort Yomra escort Perşembe escort Pazar escort Onikişubat escort Pazarcık escort Türkoğlu escort Eynesil escort Görele escort Piraziz escort Yağlıdere escort Çayıralan escort Boğazlıyan escort Zile escort Siverek escort Karaköprü escort Haliliye escort Akçakale escort Şarkışla escort Gemerek escort Oltu escort Palandöken escort Mudurnu escort Suluova escort Taşova escort Toprakkale escort Kilimli escort Tuşba escort Üzümlü escort