Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production builds failing in ember 3.4.4 | Build Error (UglifyWriter) #49

Closed
esbanarango opened this issue Sep 28, 2018 · 15 comments
Closed

Comments

@esbanarango
Copy link

Similar to #35. I'm deploying this APP to heroku using the nodejs heroku buildpack

package.json

    "ember-cli-uglify": "^2.1.0",
    "ember-cli": "~3.4.1",
    "ember-source": "3.4.4",

Error details:

ember-cli: 3.4.3
node: 8.12.0
os: linux x64

Environment: production
cleaning up...

Build Error (UglifyWriter)

Cannot read property '_walk' of null
Workaround
module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    // ...
    'ember-cli-uglify': {
      uglify: {
        compress: false // added this to workaround the issue
      }
    },
    // ...
@bajcmartinez
Copy link

bajcmartinez commented Sep 28, 2018

Same error here, also reported in ember-cli

ember-cli/ember-cli#8075

NPM Log:

ENV Summary:

  TIME: Fri Sep 28 2018 10:27:46 GMT-0400 (Eastern Daylight Time)
  TITLE: ember
  ARGV:
  - /Users/z002fawe/.nvm/versions/node/v10.9.0/bin/node
  - /Users/z002fawe/.nvm/versions/node/v10.9.0/bin/ember
  - build
  - --environment=production
  EXEC_PATH: /Users/z002fawe/.nvm/versions/node/v10.9.0/bin/node
  TMPDIR: /var/folders/5g/tl5x1p1d15bbrv8fg4r1xmcw0000gn/T
  SHELL: /bin/bash
  PATH:
  - /usr/local/bin
  - /usr/bin
  - /bin
  - /usr/sbin
  - /sbin
  - /Applications/Wireshark.app/Contents/MacOS
  - /Applications/Postgres.app/Contents/Versions/10/bin/
  - /anaconda3/bin
  - /Users/z002fawe/.nvm/versions/node/v10.9.0/bin
  PLATFORM: darwin x64
  FREEMEM: 1813299200
  TOTALMEM: 17179869184
  UPTIME: 90110
  LOADAVG: 3.5947265625,2.98388671875,2.85546875
  CPUS:
  - Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz - 2200
  - Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz - 2200
  - Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz - 2200
  - Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz - 2200
  - Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz - 2200
  - Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz - 2200
  - Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz - 2200
  - Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz - 2200
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.14.0
  - cldr: 33.1
  - http_parser: 2.8.0
  - icu: 62.1
  - modules: 64
  - napi: 3
  - nghttp2: 1.32.0
  - node: 10.9.0
  - openssl: 1.1.0i
  - tz: 2018e
  - unicode: 11.0
  - uv: 1.22.0
  - v8: 6.8.275.24-node.14
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: TypeError: Cannot read property '_walk' of null
    at AST_Dot.eval (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1145:29)
    at TreeWalker._visit (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1546:21)
    at AST_Dot._walk (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1144:24)
    at AST_VarDef.eval (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1091:40)
    at TreeWalker._visit (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1546:21)
    at AST_VarDef._walk (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1089:24)
    at AST_Var.eval (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:999:32)
    at TreeWalker._visit (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1546:21)
    at AST_Var._walk (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:996:24)
    at walk_body (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:510:17)
  - codeFrame: Cannot read property '_walk' of null
  - errorMessage: Build Canceled: Broccoli Builder ran into an error with `UglifyWriter` plugin. 💥
Cannot read property '_walk' of null
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
    - treeDir: [undefined]
  - message: Build Canceled: Broccoli Builder ran into an error with `UglifyWriter` plugin. 💥
Cannot read property '_walk' of null
  - name: Error
  - nodeAnnotation: UglifyWriter
  - nodeName: UglifyWriter
  - originalErrorMessage: Cannot read property '_walk' of null
  - stack: TypeError: Cannot read property '_walk' of null
    at AST_Dot.eval (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1145:29)
    at TreeWalker._visit (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1546:21)
    at AST_Dot._walk (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1144:24)
    at AST_VarDef.eval (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1091:40)
    at TreeWalker._visit (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1546:21)
    at AST_VarDef._walk (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1089:24)
    at AST_Var.eval (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:999:32)
    at TreeWalker._visit (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:1546:21)
    at AST_Var._walk (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:996:24)
    at walk_body (eval at <anonymous> (/Users/z002fawe/Projects/product-advisor/test/pa-aurora-frontend/node_modules/terser/tools/node.js:21:1), <anonymous>:510:17)

=================================================================================

here are my variable versions:

ember-cli: 3.4.1
http_parser: 2.8.0
node: 10.9.0
v8: 6.8.275.24-node.14
uv: 1.22.0
zlib: 1.2.11
ares: 1.14.0
modules: 64
nghttp2: 1.32.0
napi: 3
openssl: 1.1.0i
icu: 62.1
unicode: 11.0
cldr: 33.1
tz: 2018e
os: darwin x64
6.4.1
1.6.0

@KyleCartmell
Copy link

Hey, I got a fix for this that got my build back up and running!
ember-cli/ember-cli#8075 (comment)

@rwjblue
Copy link
Member

rwjblue commented Sep 30, 2018

We should confirm with the terser folks that this is a known issue...

@jrjohnson
Copy link
Contributor

Terser is (understandably) waiting for a minimal reproduction terser/terser#120 I have no idea how to produce that.

@ryanto
Copy link
Member

ryanto commented Jan 4, 2019

Heya! We just ran into this issue today while upgrading our app. Is compress: false still the best way to fix this?

@donaldsonjulia
Copy link

This appears to have been fixed by Terser. I was able to remove the workaround from our config after updating ember-cli-uglify to 2.1.0. App builds fine now.

(As a note, we recently discovered that the workaround caused an issue with our app's ability to run in IE11. Updating version and removing the workaround fixed that problem.)

@rwjblue
Copy link
Member

rwjblue commented Feb 28, 2019

Awesome, thank you @donaldsonjulia!

@rwjblue rwjblue closed this as completed Feb 28, 2019
@udhayakumargururaj
Copy link

udhayakumargururaj commented May 5, 2019

@donaldsonjulia - getting JS heap out of memory error on production build. when we upgrade ember-cli-uglify to 2.1.0 or 3.0.0

@edipox
Copy link

edipox commented Jun 10, 2020

In my case I got:

Build Error (UglifyWriter)
Unexpected token: eof (undefined)

The solution was to update ember-cli-moment-shim to version v3.8.0

@betocantu93
Copy link

@edipox I'm glad the dep update has fixed your build, I just updated ember-cli-moment-shim, but we're still having issues, would you mind sharing how you came up with that exact dep?

My error is:

Build Error (UglifyWriter)

Unexpected token: punc (.)

Thanks in advance

@jrjohnson
Copy link
Contributor

@betocantu93 discovering this issue is a bit of an involved process with two possible paths.

  1. Do a git-bisect from a working build and try and figure out exactly what update causes the failure. Then add that addon to a fresh ember app and see if the issue is resolved.
  2. Produce an app.js file by running your ember build with uglify disabled:
var app = new EmberApp({
  'ember-cli-uglify': {
    enabled: true,
  },
});

ember build -e=production

Then you can take that file and run it through terser manually dist/assets/app.js -c sequences=30` and see if you can spot the failure.

Last time I ended up going chunk by chunk deleting things from that app.js file until I found the broken bit.

I haven't found an easier path, maybe someone else has?

@betocantu93
Copy link

betocantu93 commented Jun 29, 2020

Documenting my journey, I did what @jrjohnson suggested and here are my findings

  1. Optional chaining is not yet supported by terser.js Nullish coalescing / optional chaining support terser/terser#567, in the end was a targets.js version issue for optional-chaining I had to use last 2 Chrome versions to fix it, instead of last 1 Chrome versions, you can find more info here: https://discord.com/channels/480462759797063690/485861149821239298/725725873851990066

  2. As @edipox suggested, ember-cli-moment-shim needs to be updated to 3.8.0

Thanks both for answering/documenting

@EvgenyOrekhov
Copy link

@betocantu93 You saved my day. The only thing is that using last 2 Chrome versions doesn't work anymore (time flies), I had to use Chrome 79 (optional chaining was added in Chrome 80).

@betocantu93
Copy link

@EvgenyOrekhov yes, I think I end up doing just that a couple of days later when the build started to fail again, I pinned the Chrome version to a safe one until terser catches up

@rami-alloush
Copy link

Nothing worked for me. I ended up completely removing ember-cli-uglify and using ember-cli-terser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests