Next.js: next build hangs forever after upgrade to v8

Created on 25 Jun 2019  路  7Comments  路  Source: vercel/next.js

Bug report

Describe the bug

I've upgraded to Next.js 8 and noticed my next build (which is triggered by yarn build) leaves process hanging forever and doesn't exit it. So, my CI is timing out and we can't push the upgrade to production yet.

To Reproduce

Simply running next build. Here's my current next.config.js:

const webpack = require('webpack')
const path = require('path')
const package = require('./package.json')
const DotenvPlugin = require('dotenv-webpack')
const withProgressBar = require('next-progressbar')
const withOffline = require('next-offline')
const withCSS = require('@zeit/next-css')
const isProduction = process.env.NODE_ENV === 'production'

module.exports = withOffline(withCSS(withProgressBar({
  progressBar: {
    profile: true,
  },

  workboxOpts: {
    runtimeCaching: [
      {
        urlPattern: /^https?.*/,
        handler: 'networkFirst',
        options: {
          cacheName: 'name-v' + package.version,
          expiration: {
            maxEntries: 50,
            maxAgeSeconds: 7 * 24 * 60 * 60,
            purgeOnQuotaError: true,
          },
        },
      },
    ],
  },

  webpack: (config, { isServer }) => {
    config.plugins.push(new DotenvPlugin({
      systemvars: isProduction,
    }))

    if (!isServer) {
      config.module.rules.unshift({
        test: /\.worker\.js$/,
        use: [{
          loader: 'worker-loader',
          options: {
            inline: true,
          },
        }],
      })
    }

    /**
     * Hotfix for new webpack hot reload bug
     */
    if (!isServer) {
      config.output.globalObject = 'self'
    }

    return config
  },
})))

Expected behavior

Process should exit after compilation is successful.

Screenshots

Screen Shot 2019-06-25 at 12 30 18

System information

  • OS: macOS Mojave 10.14.3 (but same thing occurs in CircleCI, which I believe runs some Linux distro)
  • Browser (if applies): N/A
  • Version of Next.js: ^8.1.0

Additional context

Not many changes, I simply upgraded Next from v7 to v8. It also seems to have no warnings of peer dependencies compatibility issues. Everything else is running fine. If I ctrl+C the build process and run yarn start, everything is working just fine. Development server is working perfectly as well.

I found similar issues (https://github.com/zeit/next.js/issues/7567, https://github.com/zeit/next.js/issues/4647, https://github.com/zeit/next.js/issues/6419) suggesting to install next-progressbar, removing node_modules, yarn.lock, package-lock.json, .next directory etc. I did all of that but absolutely nothing changed this outcome.

Any thoughts? Thanks 馃槄

Most helpful comment

Can you please try next@canary? I assume one of your pages is establishing a connection or similar and never allows the process to exit.

All 7 comments

Can you please try next@canary? I assume one of your pages is establishing a connection or similar and never allows the process to exit.

Can you please try next@canary? I assume one of your pages is establishing a connection or similar and never allows the process to exit.

Works (^8.1.1-canary.57)!

Screen Shot 2019-06-25 at 18 39 17

+1

Closing this because you said it works @gugiserman!

Updating to canary also fixed for me.

Same issue I am facing with firebase. Help me

Upgrading Next.js to latest version solved my issue

NOTE: kindly avoid [email protected]. (Build bundling stuck for forever and not exiting).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kenji4569 picture kenji4569  路  3Comments

renatorib picture renatorib  路  3Comments

rauchg picture rauchg  路  3Comments

formula349 picture formula349  路  3Comments

sospedra picture sospedra  路  3Comments