question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Property left of ForInStatement expected node to be of a type ["VariableDeclaration","LVal"] but instead got null

See original GitHub issue

Bug Report

As of 7.8.7 I’m getting the error Property left of ForInStatement expected node to be of a type ["VariableDeclaration","LVal"] but instead got null

Our CI runs like so automatically on every commit:

    - apt install -y nodejs npm
    - npm -g -D install webpack webpack-cli babel-loader @babel/core @babel/preset-env babel-polyfill
    - cd ./webapp/js/
    - webpack --config webpack.dist.js

Here’s the stack trace coming out of webpack CLI

ERROR in ./apps/application/controllers/controllers.addactivity.js
Module build failed (from /usr/local/lib/node_modules/babel-loader/lib/index.js):
TypeError: /Users/henry/Documents/application/application-website/webapp/js/apps/application/controllers/controllers.addactivity.js: Property left of ForInStatement expected node to be of a type ["VariableDeclaration","LVal"] but instead got null
    at Object.validate (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/utils.js:131:11)
    at validateField (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/types/lib/validators/validate.js:24:9)
    at Object.validate (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/types/lib/validators/validate.js:17:3)
    at NodePath._replaceWith (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/replacement.js:172:7)
    at NodePath._remove (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/removal.js:55:10)
    at NodePath.remove (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/removal.js:34:8)
    at hooks (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js:11:12)
    at NodePath._callRemovalHooks (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/removal.js:46:9)
    at NodePath.remove (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/removal.js:26:12)
    at convertFunctionParams (/usr/local/lib/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-parameters/lib/params.js:88:30)
    at PluginPass.Function (/usr/local/lib/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-parameters/lib/index.js:30:53)
    at newFn (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/visitors.js:179:21)
    at NodePath._call (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:31)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitMultiple (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:79:17)
    at TraversalContext.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:138:19)
    at Function.traverse.node (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitSingle (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:84:19)
    at TraversalContext.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:140:19)
    at Function.traverse.node (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitMultiple (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:79:17)
    at TraversalContext.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:138:19)
    at Function.traverse.node (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitSingle (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:84:19)
    at TraversalContext.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:140:19)
    at Function.traverse.node (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
 @ multi /usr/local/lib/node_modules/babel-polyfill/ ./application/ironhide.js ./application/utility.js ./apps/application/services/services.js ./apps/application/services/services.appsdevices.js ./apps/application/services/services.branding.js ./apps/application/services/services.ionic.webapp.js ./apps/application/services/services.geo.webapp.js ./apps/application/services/services.minicache.js ./apps/application/services/services.devicesync.webapp.js ./apps/application/services/services.unifyapi.webapp.js ./apps/application/services/services.webappmenu.webapp.js ./apps/application/services/services.localforage.webapp.js ./apps/application/services/services.benefitplanutilities.js ./apps/application/services/services.dateutilities.js ./apps/application/directives/directives.earningsrow.js ./apps/application/directives/directives.helptext.js ./apps/application/directives/directives.helpmodal.js ./apps/application/directives/directives.miniplanbuilder.js ./apps/application/directives/directives.progressbar.js ./apps/application/directives/directives.validation.js ./apps/application/directives/directives.cyberfilters.js ./apps/application/directives/directives.chart.js ./apps/application/directives/directives.surveypage.js ./apps/application/directives/directives.focus.js ./apps/application/directives/directives.selectemployeetags.js ./apps/application/directives/directives.selectcompanyid.js ./apps/application/data/applicationDataSource.js ./apps/application/components/applicationGrid.js ./apps/workstation/components/grid.js ./apps/application/controllers/controllers.js ./apps/application/controllers/controllers.auth.js ./apps/application/controllers/controllers.timeline.js ./apps/application/controllers/controllers.commprefs.js ./apps/application/controllers/controllers.account.js ./apps/application/controllers/controllers.addactivity.js ./apps/application/controllers/controllers.appsdevices.js ./apps/application/controllers/controllers.benefit.js ./apps/application/controllers/controllers.earnings.js ./apps/application/controllers/controllers.challenges.js ./apps/application/controllers/controllers.company.js ./apps/application/controllers/controllers.customer.js ./apps/application/controllers/controllers.rewardsmall.js ./apps/application/controllers/controllers.orgsettings.taxreporting.js ./apps/application/controllers/controllers.newrewardsettings.js ./apps/application/controllers/controllers.reports.individuals.js ./apps/application/controllers/controllers.reports.activities.js ./apps/application/controllers/controllers.reports.rewards.js ./apps/application/controllers/controllers.reports.disbursements.js ./apps/application/controllers/controllers.reports.surveys.js ./apps/application/controllers/controllers.reports.healthcard.js ./apps/application/controllers/controllers.communications.js ./apps/application/controllers/controllers.events.js ./apps/application/controllers/controllers.menu.js ./apps/application/controllers/controllers.surveys.js ./apps/application/controllers/controllers.manage_orgs.js ./apps/application/controllers/controllers.employeeaddress.js ./apps/application/webapp.js webapp[35]

ERROR in ./application/ironhide.js
Module build failed (from /usr/local/lib/node_modules/babel-loader/lib/index.js):
TypeError: /Users/henry/Documents/application/application-website/webapp/js/application/ironhide.js: Property left of ForInStatement expected node to be of a type ["VariableDeclaration","LVal"] but instead got null
    at Object.validate (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/utils.js:131:11)
    at validateField (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/types/lib/validators/validate.js:24:9)
    at Object.validate (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/types/lib/validators/validate.js:17:3)
    at NodePath._replaceWith (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/replacement.js:172:7)
    at NodePath._remove (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/removal.js:55:10)
    at NodePath.remove (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/removal.js:34:8)
    at hooks (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js:11:12)
    at NodePath._callRemovalHooks (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/removal.js:46:9)
    at NodePath.remove (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/removal.js:26:12)
    at convertFunctionParams (/usr/local/lib/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-parameters/lib/params.js:88:30)
    at PluginPass.Function (/usr/local/lib/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-parameters/lib/index.js:30:53)
    at newFn (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/visitors.js:179:21)
    at NodePath._call (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:31)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitSingle (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:84:19)
    at TraversalContext.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:140:19)
    at Function.traverse.node (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitMultiple (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:79:17)
    at TraversalContext.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:138:19)
    at Function.traverse.node (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitSingle (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:84:19)
    at TraversalContext.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:140:19)
    at Function.traverse.node (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitSingle (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:84:19)
    at TraversalContext.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:140:19)
    at Function.traverse.node (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
 @ multi /usr/local/lib/node_modules/babel-polyfill/ ./application/ironhide.js ./application/utility.js ./apps/application/services/services.js ./apps/application/services/services.appsdevices.js ./apps/application/services/services.branding.js ./apps/application/services/services.ionic.webapp.js ./apps/application/services/services.geo.webapp.js ./apps/application/services/services.minicache.js ./apps/application/services/services.devicesync.webapp.js ./apps/application/services/services.unifyapi.webapp.js ./apps/application/services/services.webappmenu.webapp.js ./apps/application/services/services.localforage.webapp.js ./apps/application/services/services.benefitplanutilities.js ./apps/application/services/services.dateutilities.js ./apps/application/directives/directives.earningsrow.js ./apps/application/directives/directives.helptext.js ./apps/application/directives/directives.helpmodal.js ./apps/application/directives/directives.miniplanbuilder.js ./apps/application/directives/directives.progressbar.js ./apps/application/directives/directives.validation.js ./apps/application/directives/directives.cyberfilters.js ./apps/application/directives/directives.chart.js ./apps/application/directives/directives.surveypage.js ./apps/application/directives/directives.focus.js ./apps/application/directives/directives.selectemployeetags.js ./apps/application/directives/directives.selectcompanyid.js ./apps/application/data/applicationDataSource.js ./apps/application/components/applicationGrid.js ./apps/workstation/components/grid.js ./apps/application/controllers/controllers.js ./apps/application/controllers/controllers.auth.js ./apps/application/controllers/controllers.timeline.js ./apps/application/controllers/controllers.commprefs.js ./apps/application/controllers/controllers.account.js ./apps/application/controllers/controllers.addactivity.js ./apps/application/controllers/controllers.appsdevices.js ./apps/application/controllers/controllers.benefit.js ./apps/application/controllers/controllers.earnings.js ./apps/application/controllers/controllers.challenges.js ./apps/application/controllers/controllers.company.js ./apps/application/controllers/controllers.customer.js ./apps/application/controllers/controllers.rewardsmall.js ./apps/application/controllers/controllers.orgsettings.taxreporting.js ./apps/application/controllers/controllers.newrewardsettings.js ./apps/application/controllers/controllers.reports.individuals.js ./apps/application/controllers/controllers.reports.activities.js ./apps/application/controllers/controllers.reports.rewards.js ./apps/application/controllers/controllers.reports.disbursements.js ./apps/application/controllers/controllers.reports.surveys.js ./apps/application/controllers/controllers.reports.healthcard.js ./apps/application/controllers/controllers.communications.js ./apps/application/controllers/controllers.events.js ./apps/application/controllers/controllers.menu.js ./apps/application/controllers/controllers.surveys.js ./apps/application/controllers/controllers.manage_orgs.js ./apps/application/controllers/controllers.employeeaddress.js ./apps/application/webapp.js webapp[1]

Our config is:

use: {
    loader: 'babel-loader',
    query: {
        /* This makes babel use the node global install directory as the project root during compile so that presets installed globally load correctly  */
        cwd: path.resolve(nodeModulesPath),
        presets: [
            [
                '@babel/preset-env', {
                    targets: {
                        'ie': '11'
                    },
                    //'corejs': 2, // @see https://babeljs.io/docs/en/babel-preset-env#corejs
                    'useBuiltIns': false
                }
            ]
        ] // presets
    } // query
}

This has been mentioned here as well: https://github.com/apexcharts/apexcharts.js/issues/1359

- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
- Node/npm version: [Node v11.15.0/npm 6.14.2]
- OS: [OSX and Ubuntu]
- Monorepo: [no]
- How you are using Babel: [`loader` via Webpack CLI]

The problem started on March 5th when our CI webpacks started failing.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hparadizcommented, Mar 11, 2020

I’ve narrowed down the issue to this commit https://github.com/babel/babel/commit/9015fda3c106abda6928cf348797a38f09d4b3e0#diff-296be6d02e0f5a9eb2cda2c37099166f

I have downgraded to @babel/plugin-transform-parameters@7.4.4 and @babel/preset-env@7.7.1 for now. We have hundreds of instances of (var i in thing) so I’m gonna wait till it’s fixed to update the packages.

0reactions
nicolo-ribaudocommented, Mar 12, 2020

Released!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Property left of ForInStatement expected node to be ...
throw error: TypeError: Property left of ForInStatement expected node to be of a type ["VariableDeclaration","LVal"] but instead got null.
Read more >
Property body[41] of BlockStatement expected node to be of a ...
This appears to be a bug with 7.15.0 of Babel which they are making a E2E React native regression test for. Updated answer....
Read more >
JasmineJS - Null Check - Tutorialspoint
JasmineJS - Null Check, Jasmine provides a different variety of method to check whether the actual output is Null, defined or undefined.
Read more >
Could not parse field. expected a string array but found null ...
A detailed guide on how to resolve errors related to "could not parse field. expected a string array but found null value instead"...
Read more >
Cannot read property 'scale' of null" after dragging the map
Occasionally the exception "Uncaught TypeError: Cannot read property 'scale' of null" is thrown, but for the most part no exceptions show up in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found