nuxt: The 91% chunk asset optimization problem

Running npm run generate hangs at 91% (or 92%) chunk asset optimization. Works fine on Linux (using Solus) but freezes on WSL (Bash on Ubuntu on Windows).

Possible correlated issues:

  • webpack/webpack#4550
  • webpack/webpack#4558
  • webpack-contrib/babel-minify-webpack-plugin#49
  • mishoo/UglifyJS2#2609
  • JeffreyWay/laravel-mix#926
  • angular/angular-cli#5775
  • gdi2290/angular-starter#1925

I disabled UglifyJS using @Atinux method in nuxt/nuxt.js#250 and it built.

<div align="right">This question is available on Nuxt.js community (#c2535)</div>

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 27
  • Comments: 43 (3 by maintainers)

Most upvoted comments

Just tried to add this option to my nuxt-config


module.exports = {
  build: {
    // ...

    uglify: {
      uglifyOptions: {
        compress: false
      },
      cache: '/path/to/cache/dir'
    },

    // ...
  },

  // ...
}

as suggested here and now it’s working in my local.

https://nuxtjs.org/api/configuration-build/#optimization

import TerserPlugin from 'terser-webpack-plugin'
build: {
    optimization: {
      minimize: true,
      minimizer: [
        new TerserPlugin({
          cache: true,
          parallel: false
        })
      ]
    }
}

It works on WSL. Nuxt version: 2.4.5.

I’m also having this issue under WSL.

Builds hanging at 91% on WSL as well (Ubuntu 18.04)

optimization: { minimize: false }

This will solve the problem

I was stepping onto the same issue.

It seems to work when I remove the dist directory before running nuxt-ts generate

"generate": "rm -rf dist && nuxt-ts generate",

Disabling minification (build.optimization.minimize) can help. https://nuxtjs.org/api/configuration-build/#optimization

我在本地可以正常npm run build,但是aws的ec2中会卡在90% 终极解决办法: 编辑.gitignore文件,取消.nuxt目录及dist目录的ignore,所以以后更新线上代码都通过本地先npm run build然后线上直接运行,(即线上不进行npm run build)

I’m also having this issue under WSL. at 91%

I added a swapfile on my VM and the process completed successfully. You guys should definitely give it a try.

Here are some good instructions on how to do it: How To Add Swap on Ubuntu

https://nuxtjs.org/api/configuration-build/#optimization

import TerserPlugin from 'terser-webpack-plugin'
build: {
    optimization: {
      minimize: true,
      minimizer: [
        new TerserPlugin({
          cache: true,
          parallel: false
        })
      ]
    }
}

it works in WSL. “nuxt”: “2.4.5”

@laogui Confirmed working in Nuxt 2.6.1 on WSL. The Swapfile solution higher in the thread didn’t make a difference for me.

First, install Terser:

npm install terser-webpack-plugin --save-dev or yarn add terser-webpack-plugin

then copy/paste the above from @laogui .

Still have this issue with the latest Nuxt version (2.3.4)

had this problem, using nuxt v2.3.4 on WSL

it works when i disable the minification, and my system has plenty of free memory to be used (~4GB) so cant be out of memory problem, how to solve this problem?

Resolved the issue by using nuxt-edge 2.1.0-25638752.fdb225f instead of nuxt 1.4.2

I suddenly have this issue after switching to postcss instead of scss and installing postcss-nested.

I add 4G swap. And then I ran nuxt build.

Before image

Building… image

it was stopped at 91%. image

Build hanging at 90% (Ubuntu 16.04) not WSL