Create-react-app: uglify error while doing `npm run build`

Created on 17 Aug 2017  Â·  3Comments  Â·  Source: facebook/create-react-app

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

5.3.0

Which terms did you search for in User Guide?

I searched for TypeError: Cannot read property 'reset' of undefined

Environment

  1. node -v: v6.10.0
  2. npm -v: 5.3.0
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven’t ejected): [email protected]

Then, specify:

  1. Operating system: Mac OS X
  2. Browser and version (if relevant):

Steps to Reproduce

(Write your steps here:)

  1. I ran npm run build which I used to create a deployable build. It used to work fine with react-scripts 1.0.6 Now with the latest react-scripts, I get the following error:
➜  frontend-web git:(master) npm run build

> [email protected] build /Users/psankar/go/src/gitlab.com/kaigal/kaigal/frontend-web
> react-scripts build

Creating an optimized production build...
Failed to compile.

Failed to minify the bundle. Error: static/js/main.d0e43aae.js from UglifyJs
TypeError: Cannot read property 'reset' of undefined
    at Array.forEach (native)
    at compiler.run (/Users/psankar/go/src/gitlab.com/kaigal/kaigal/frontend-web/node_modules/react-scripts/scripts/build.js:130:23)
    at emitRecords.err (/Users/psankar/go/src/gitlab.com/kaigal/kaigal/frontend-web/node_modules/webpack/lib/Compiler.js:269:13)
    at Compiler.emitRecords (/Users/psankar/go/src/gitlab.com/kaigal/kaigal/frontend-web/node_modules/webpack/lib/Compiler.js:375:38)
    at emitAssets.err (/Users/psankar/go/src/gitlab.com/kaigal/kaigal/frontend-web/node_modules/webpack/lib/Compiler.js:262:10)
    at applyPluginsAsyncSeries1.err (/Users/psankar/go/src/gitlab.com/kaigal/kaigal/frontend-web/node_modules/webpack/lib/Compiler.js:368:12)
    at next (/Users/psankar/go/src/gitlab.com/kaigal/kaigal/frontend-web/node_modules/tapable/lib/Tapable.js:218:11)
    at Compiler.compiler.plugin (/Users/psankar/go/src/gitlab.com/kaigal/kaigal/frontend-web/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at next (/Users/psankar/go/src/gitlab.com/kaigal/kaigal/frontend-web/node_modules/tapable/lib/Tapable.js:220:14)
    at /Users/psankar/go/src/gitlab.com/kaigal/kaigal/frontend-web/node_modules/sw-precache-webpack-plugin/lib/index.js:98:18
Read more here: http://bit.ly/2tRViJ9

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/psankar/.npm/_logs/2017-08-17T10_36_16_498Z-debug.log
➜  frontend-web git:(master)

Expected Behavior

Build happens cleanly

Actual Behavior

The above error was shown.

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Most helpful comment

After a bit more of googling, I did a rm -rf node_modules and reinstalled all the dependencies once again and everything works fine now. I will close the bug. Thanks.

All 3 comments

Please provide a minimal project reproducing this.

After a bit more of googling, I did a rm -rf node_modules and reinstalled all the dependencies once again and everything works fine now. I will close the bug. Thanks.

Duplicate issue: https://github.com/facebookincubator/create-react-app/issues/2953
This has something to do with _uglifyjs-webpack-plugin_ plugin

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dualcnhq picture dualcnhq  Â·  3Comments

oltsa picture oltsa  Â·  3Comments

DaveLindberg picture DaveLindberg  Â·  3Comments

JimmyLv picture JimmyLv  Â·  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  Â·  3Comments