You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@babel/core^7.13.10 eslint error: Cannot read property 'value' of null when @babel/types are duplicated in node_modules #12985
Hey @roojay520! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."
So I had this issue a while back and fixed it via #10904
But I updated again and it is back.
TypeError: Cannot read property 'value' of null
Occurred while linting /bulk_invoice_processor/index.js:116
at checkSpacingBefore (node_modules/eslint/lib/rules/template-curly-spacing.js:52:24)
at TemplateElement (eslint/lib/rules/template-curly-spacing.js:136:17)
@nicolo-ribaudo Sorry! Because I'm using it with webpack, doesn't have complete stack trace. After debug yesterday, I found it should be the problem with the template string. When I prepared the demo again today, the error seemed to disappear again. It's weird.
This issue is likely due to duplicate and different versions of@babel/types in node_modules, although we tried to maintain compatibilities across different versions, it is quite hard for us to reproduce such issue because of the exponential combination of @babel/*.
That said, you can solve this issue by removing your lock files and installing again, or maybe npm dedupe. But without a reproducing repo we can't dig this issue further down.
On Wed, Mar 10, 2021, 7:31 AM Huáng Jùnliàng ***@***.***> wrote:
This issue is likely due to duplicate and *different* versions of
@babel/types in node_modules, although we tried to maintain
compatibilities across different versions, it is quite hard for us to
reproduce such issue because of the exponential combination of @babel/*.
That said, you can solve this issue by removing your lock files and
installing again, *or* maybe npm dedupe. But without a reproducing repo
we can't dig this issue further down.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12985 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACIEOMPCY7PXSAJZGCSFQYDTC5RB5ANCNFSM4Y3ANKSQ>
.
So I solved my issue. Seemed to be a babel conflict, I was using parser: '@babel/eslint-parser' but I was importing a eslint config that was using the old version
@kwangure Thanks for the reproduction repo. I can reproduce this issue. However, if I remove package-lock.json and install using yarn, the linter works as expected. I guess it is related to how dependencies are hoisted between different package managers. Still investigating.
@kwangure I think I have figured out what's going wrong here. Currently @babel/eslint-parser will fail when @babel/types is duplicated, specifically when both @babel/core and @babel/traverse have their own copies of @babel/types. Before we fix this issue, make sure you have run npm dedupe so @babel/types will be deduplicated.
You can check whether @babel/types is correctly deduplicated by
changed the title [-]@babel/core^7.13.10 eslint error: Cannot read property 'value' of null (v7.12.9 works fine)[/-][+]@babel/core^7.13.10 eslint error: Cannot read property 'value' of null when @babel/types are duplicated in node_modules[/+]on Mar 10, 2021
We were able to solve this by not only deduping but also updating all of the nested versions. I found some on 7.13.14 and some on 7.13.17 so I ran these:
Activity
babel-bot commentedon Mar 9, 2021
Hey @roojay520! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."
nicolo-ribaudo commentedon Mar 9, 2021
Can you share the complete stack trace?
ChrisWiles commentedon Mar 9, 2021
So I had this issue a while back and fixed it via #10904
But I updated again and it is back.
nicolo-ribaudo commentedon Mar 9, 2021
I tried creating a project with the files in #12985 (comment) but I cannot reproduce the error 😕
@ChrisWiles / @roojay520 Could you also share a repository which reproduces the bug? 🙏
ChrisWiles commentedon Mar 9, 2021
@nicolo-ribaudo Also I am using NPM v6.14.11 to install
roojay commentedon Mar 10, 2021
@nicolo-ribaudo Sorry! Because I'm using it with webpack, doesn't have complete stack trace. After debug yesterday, I found it should be the problem with the template string. When I prepared the demo again today, the error seemed to disappear again. It's weird.
JLHwung commentedon Mar 10, 2021
This issue is likely due to duplicate and different versions of
@babel/typesin node_modules, although we tried to maintain compatibilities across different versions, it is quite hard for us to reproduce such issue because of the exponential combination of@babel/*.That said, you can solve this issue by removing your lock files and installing again, or maybe
npm dedupe. But without a reproducing repo we can't dig this issue further down.ChrisWiles commentedon Mar 10, 2021
milkbump commentedon Mar 10, 2021
Minimal repro at https://github.com/kwangure/babel-eslint-property-null-repro. Hope it helps.
ChrisWiles commentedon Mar 10, 2021
So I solved my issue. Seemed to be a babel conflict, I was using
parser: '@babel/eslint-parser'but I was importing a eslint config that was using the old versionextends: [packageThatWasUsingOldParserVersion]JLHwung commentedon Mar 10, 2021
@kwangure Thanks for the reproduction repo. I can reproduce this issue. However, if I remove
package-lock.jsonand install usingyarn, the linter works as expected. I guess it is related to how dependencies are hoisted between different package managers. Still investigating.nicolo-ribaudo commentedon Mar 10, 2021
@JLHwung I don't know if it helps, but I noticed in that repository we generate different
tokensfor template literals than what ESLint usually does.JLHwung commentedon Mar 10, 2021
Yeah those tokens are generated from https://github.com/babel/babel/blob/main/eslint/babel-eslint-parser/src/convert/convertTokens.js#L22 . I can not reproduce this error on Babel repo, likely because we are using
yarn.JLHwung commentedon Mar 10, 2021
@kwangure I think I have figured out what's going wrong here. Currently
@babel/eslint-parserwill fail when@babel/typesis duplicated, specifically when both@babel/coreand@babel/traversehave their own copies of@babel/types. Before we fix this issue, make sure you have runnpm dedupeso@babel/typeswill be deduplicated.You can check whether
@babel/typesis correctly deduplicated byIt should look like
I removed the
regressiontag as this issue affects all@babel/eslint-parserversions.[-]@babel/core^7.13.10 eslint error: Cannot read property 'value' of null (v7.12.9 works fine)[/-][+]@babel/core^7.13.10 eslint error: Cannot read property 'value' of null when @babel/types are duplicated in node_modules[/+]milkbump commentedon Mar 11, 2021
Just
npm dedupedidn't seem to help. But I deleted my lock file and then deduped. I no longer get the errors. Thanks!alexbbt commentedon Apr 21, 2021
We were able to solve this by not only deduping but also updating all of the nested versions. I found some on
7.13.14and some on7.13.17so I ran these:Then I removed the newly saved dep from
package.jsonand did anothernpm ijust to make sure the lock file was up to date.