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

TypeError: Cannot read property '_walk' of null #928

Closed
ariovistus opened this issue Oct 9, 2018 · 14 comments · Fixed by #941
Closed

TypeError: Cannot read property '_walk' of null #928

ariovistus opened this issue Oct 9, 2018 · 14 comments · Fixed by #941

Comments

@ariovistus
Copy link

I'm submitting a bug report

  • Library Version:
    0.32.0

Please tell us about your environment:

  • Operating System:
    Linux (fedora)

  • Node Version:
    8.12.0

  • NPM Version:
    6.4.1

  • Browser:
    all

  • Language:
    all

  • Loader/bundler:
    RequireJS

Current behavior:
I managed to build something that uglifyjs pukes on:
https://travis-ci.org/frc3223/stats/builds/438988302

turning off minification is a workaround, but I'd kind of like to not have to do that
code is here: https://github.com/frc3223/stats/tree/uglibug

  • What is the expected behavior?
    app can be built with minification enabled

  • What is the motivation / use case for changing the behavior?

@3cp
Copy link
Member

3cp commented Oct 9, 2018

Your version is too old.
v0.34.0 has replaced uglify with terser for modern JS syntax compatibility.

If you upgrade to today's release v1.0.0-beta.1, make sure you follow the migration guide https://aurelia.io/blog/2018/10/08/release-aurelia-cli-with-auto-tracing-bundler

@vermilion
Copy link

vermilion commented Oct 9, 2018

@huochunpeng, faced same issue while building with prod-minify config @v1.0.0-beta.1
Everything worked fine using v0.35

ERROR [Bundle] Failed to write the bundle
INFO [Bundle] TypeError: Cannot read property '_walk' of null
...[path]\node_modules\async-done\index.js:18
    throw err;
    ^

My config in aurelia.json

    "options": {
      "minify": {
        "prod": {
          "mangle": {
            "keep_fnames": true,
            "toplevel": true
          }
        },
        "stage": {}
      },
      "sourcemaps": "dev & stage"
    },

@3cp
Copy link
Member

3cp commented Oct 9, 2018

@vermilion are you using async-done, is it the one causing trouble? I could not get async-done working in browser, my app fails.
But the bundling is ok, even with minify in prod plus your minify config.

@vermilion
Copy link

This is my new auto-tracing log. I don't use it explicitly, maybe some of deps are using it... How could I find such?

INFO [Bundle] Manually adding package: 2.3.0      aurelia-bootstrapper
INFO [Bundle] Manually adding package: 1.0.4      aurelia-loader-default
INFO [Bundle] Manually adding package: 1.8.0      aurelia-pal-browser
INFO [Bundle] Manually adding package: 2.0.15     text
INFO [Bundler] Tracing files ...
INFO [Bundler] Auto tracing package: 1.1.4      au-bootstrap
INFO [Bundler] Auto tracing package: 1.0.0      au-configuration
INFO [Bundler] Auto tracing package: 1.3.3      au-container
INFO [Bundler] Auto tracing package: 1.1.8      au-core
INFO [Bundler] Auto tracing package: 1.0.1      au-dropdown
INFO [Bundler] Auto tracing package: 1.0.2      au-files
INFO [Bundler] Auto tracing package: 2.1.3      au-grid
INFO [Bundler] Auto tracing package: 1.0.0      au-loader
INFO [Bundler] Auto tracing package: 1.0.2      au-modals
INFO [Bundler] Auto tracing package: 1.0.0      au-notify
INFO [Bundler] Auto tracing package: 1.4.1      au-request-builder
INFO [Bundler] Auto tracing package: 2.0.5      au-select
INFO [Bundler] Auto tracing package: 2.2.3      au-sidebar-control
INFO [Bundler] Auto tracing package: 1.0.3      au-websocket
INFO [Bundler] Auto tracing package: 1.4.1      aurelia-dependency-injection
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-dialog
INFO [Bundler] Auto tracing package: 1.0.1      aurelia-event-aggregator
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-framework
INFO [Bundler] Auto tracing package: 1.2.0      aurelia-history-browser
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-loader
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-logging-console
INFO [Bundler] Auto tracing package: 1.0.4      aurelia-metadata
INFO [Bundler] Auto tracing package: 1.8.0      aurelia-pal
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-polyfills
INFO [Bundler] Auto tracing package: 1.6.3      aurelia-router
INFO [Bundler] Auto tracing package: 1.4.3      aurelia-templating-binding
INFO [Bundler] Auto tracing package: 1.7.1      aurelia-templating-resources
INFO [Bundler] Auto tracing package: 1.3.3      aurelia-templating-router
INFO [Bundler] Auto tracing package: 1.0.0-beta.3.3.2 aurelia-ui-virtualization
INFO [Bundler] Auto tracing package: 1.2.3      aurelia-validation
INFO [Bundler] Auto tracing package: 2.1.5      aurelia-binding
INFO [Bundler] Auto tracing package: 1.1.0      aurelia-history
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-http-client
INFO [Bundler] Auto tracing package: 1.5.0      aurelia-logging
INFO [Bundler] Auto tracing package: 1.1.1      aurelia-path
INFO [Bundler] Auto tracing package: 1.2.0      aurelia-route-recognizer
INFO [Bundler] Auto tracing package: 1.3.1      aurelia-task-queue
INFO [Bundler] Auto tracing package: 1.10.0     aurelia-templating
INFO [Bundler] Auto tracing package: 2.22.2     moment
INFO [Bundler] Auto tracing package: 1.4.5      tether
INFO [Bundler] Auto tracing package: 1.5.2      velocity-animate
INFO [Bundle] Writing app-bundle.js...
INFO [Bundle] Writing vendor-bundle.js...
Application Available At: http://localhost:9000
BrowserSync Available At: http://localhost:3001

@3cp
Copy link
Member

3cp commented Oct 9, 2018

Looks like this is related terser/terser#120

@3cp
Copy link
Member

3cp commented Oct 9, 2018

@vermillion nvm, async-done is deep dep of cli itself, not your frontend.

@3cp
Copy link
Member

3cp commented Oct 9, 2018

@vermillion can you share your full error log? Must be some package triggered that terser bug.

@vermilion
Copy link

Here it is - prod log

running command> au run --watch --env prod
INFO [Bundle] Manually adding package: 2.3.0      aurelia-bootstrapper
INFO [Bundle] Manually adding package: 1.0.4      aurelia-loader-default
INFO [Bundle] Manually adding package: 1.8.0      aurelia-pal-browser
INFO [Bundle] Manually adding package: 2.0.15     text
INFO [Bundler] Tracing files ...
INFO [Bundler] Auto tracing package: 1.1.4      au-bootstrap
INFO [Bundler] Auto tracing package: 1.0.0      au-configuration
INFO [Bundler] Auto tracing package: 1.3.3      au-container
INFO [Bundler] Auto tracing package: 1.1.8      au-core
INFO [Bundler] Auto tracing package: 1.0.1      au-dropdown
INFO [Bundler] Auto tracing package: 1.0.2      au-files
INFO [Bundler] Auto tracing package: 2.1.3      au-grid
INFO [Bundler] Auto tracing package: 1.0.0      au-loader
INFO [Bundler] Auto tracing package: 1.0.2      au-modals
INFO [Bundler] Auto tracing package: 1.0.0      au-notify
INFO [Bundler] Auto tracing package: 1.4.1      au-request-builder
INFO [Bundler] Auto tracing package: 2.0.5      au-select
INFO [Bundler] Auto tracing package: 2.2.3      au-sidebar-control
INFO [Bundler] Auto tracing package: 1.0.3      au-websocket
INFO [Bundler] Auto tracing package: 1.4.1      aurelia-dependency-injection
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-dialog
INFO [Bundler] Auto tracing package: 1.0.1      aurelia-event-aggregator
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-framework
INFO [Bundler] Auto tracing package: 1.2.0      aurelia-history-browser
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-loader
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-logging-console
INFO [Bundler] Auto tracing package: 1.0.4      aurelia-metadata
INFO [Bundler] Auto tracing package: 1.8.0      aurelia-pal
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-polyfills
INFO [Bundler] Auto tracing package: 1.6.3      aurelia-router
INFO [Bundler] Auto tracing package: 1.4.3      aurelia-templating-binding
INFO [Bundler] Auto tracing package: 1.7.1      aurelia-templating-resources
INFO [Bundler] Auto tracing package: 1.3.3      aurelia-templating-router
INFO [Bundler] Auto tracing package: 1.0.0-beta.3.3.2 aurelia-ui-virtualization
INFO [Bundler] Auto tracing package: 1.2.3      aurelia-validation
INFO [Bundler] Auto tracing package: 2.1.5      aurelia-binding
INFO [Bundler] Auto tracing package: 1.1.0      aurelia-history
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-http-client
INFO [Bundler] Auto tracing package: 1.5.0      aurelia-logging
INFO [Bundler] Auto tracing package: 1.1.1      aurelia-path
INFO [Bundler] Auto tracing package: 1.2.0      aurelia-route-recognizer
INFO [Bundler] Auto tracing package: 1.3.1      aurelia-task-queue
INFO [Bundler] Auto tracing package: 1.10.0     aurelia-templating
INFO [Bundler] Auto tracing package: 2.22.2     moment
INFO [Bundler] Auto tracing package: 1.4.5      tether
INFO [Bundler] Auto tracing package: 1.5.2      velocity-animate
INFO [Bundle] Writing app-bundle.js...
INFO [Bundle] Writing vendor-bundle.js...
ERROR [Bundle] Failed to write the bundle
INFO [Bundle] TypeError: Cannot read property '_walk' of null
C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\async-done\index.js:18
    throw err;
    ^

Error: Unhandled "error" event. ([object Object])
    at Gulp.emit (events.js:186:19)
    at Object.error (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\undertaker\lib\helpers\createExtensions.js:61:10)
    at handler (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\now-and-later\lib\mapSeries.js:43:14)
    at f (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\once\once.js:25:25)
    at f (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\once\once.js:25:25)
    at tryCatch (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\async-done\index.js:24:15)
    at done (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\async-done\index.js:40:12)
    at onError (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\async-done\index.js:51:5)
    at <anonymous>

Watching build tasks has finished.

@3cp
Copy link
Member

3cp commented Oct 9, 2018

@vermilion can you try this temporary fix suggested in that terser issue?

"options": {
      "minify": {
        "prod": {
          "mangle": {
            "keep_fnames": true,
            "toplevel": true
          },
          "compress": {
           "collapse_vars": false
          }
        },
        "stage": {}
      },

@3cp
Copy link
Member

3cp commented Oct 9, 2018

Seems like an issue affected the whole uglify family :-)
shipshapecode/tether#291

@vermilion
Copy link

@huochunpeng, your workaround works fine! Now waiting for an official bugfix :)

@3cp
Copy link
Member

3cp commented Oct 9, 2018

@ariovistus I guess you only need the compress config patch.

"options": {
      "minify": {
        "prod": {
          "compress": {
           "collapse_vars": false
          }
        },
        "stage": {
          "compress": {
           "collapse_vars": false
          }
        }
      },

@Alexander-Taran
Copy link
Contributor

It is "moment"
it does not like to be minified.

@3cp
Copy link
Member

3cp commented Oct 14, 2018

It seems like a nasty bug that uglify/terser guys have yet to fix. This is a combination of compress options, turn off any one of them could bypass the issue.

I think we can ship cli with a default compress options patch. I will do a PR.

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

Successfully merging a pull request may close this issue.

4 participants