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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: TypeError: Cannot set properties of undefined (setting 'kind') #15302

Closed
1 task
reesscot opened this issue Dec 22, 2022 · 20 comments 路 Fixed by #15303
Closed
1 task

[Bug]: TypeError: Cannot set properties of undefined (setting 'kind') #15302

reesscot opened this issue Dec 22, 2022 · 20 comments 路 Fixed by #15303
Labels
i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@reesscot
Copy link

馃捇

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

image

Seeing the error:

Cannot set properties of undefined (setting 'kind')

Seems related to #15300 and

Configuration file name

No response

Configuration

No response

Current and expected behavior

After release @babel/plugin-transform-block-scoping v7.20.8 seeing the error above.

Environment

System:
OS: macOS 12.6.1
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.16.0/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm

Possible solution

Does #15200 need to be reverted until the issues are all fixed?

Additional context

No response

@babel-bot
Copy link
Collaborator

Hey @reesscot! 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.

@pgaurav9
Copy link

We are also experiencing a similar issue for a react-app with the following versions:

  • node: 8.12.0
  • npm: 6.4.1

The earlier error was TypeError: 'constantViolations' of undefined however now it's TypeError: Cannot set property 'kind' of undefined. Since our project is working on an old package version so we wanted to be sure whether it's a deprecation of babel dependency that we are using or something else. Kindly provide an update on this.

@nicolo-ribaudo
Copy link
Member

A fix would be checking that every call to scope.getOwnBinding in https://github.com/babel/babel/tree/main/packages/babel-plugin-transform-block-scoping/src can return null. I can probably work on a PR in a few hours, tomorrow morning (EU) at latest, but if someone else wants to open the PR it would be much appreciated.

@liuxingbaoyu
Copy link
Member

image

I found two places, one of which I'm not sure how to do.

@nicolo-ribaudo
Copy link
Member

Maybe in the second one we could run a crawl if the binding is not present.

@rotten-bmiller
Copy link

I went back a version for @babel/plugin-transform-block-scoping and my react application is now building successfully again.
npm i @babel/plugin-transform-block-scoping@7.20.5

@ndelangen
Copy link

I'm 100% willing to help out, however I do not have sufficient knowledge to understand:

Maybe in the second one we could run a crawl if the binding is not present.

@liuxingbaoyu you seem to have 馃憤'd it, do you understand? Do you want help?

@ndelangen
Copy link

I'm also a bit hesitant to ask.. but would a roll-back to 7.20.5 be an option? Meaning releasing a new patch with the contents of 7.20.5?

I could provide a environment, in which you can replace some node_modules content and a command to run to reproduce the problem in "isolation"...

@gabriels1234
Copy link

Thanks, this is a good work-around for now.
A note to self, when dealing with these types of issues, make sure versions are pinned:
"@babel/core": "7.20.5",
vs "@babel/core": "^7.20.5", (does not fix the issue)

@liuxingbaoyu
Copy link
Member

@ndelangen v7.20.9 has been released, has the problem been solved?

@ndelangen
Copy link

Going to try now!

@ndelangen
Copy link

Looking positive!

@barbalex
Copy link

@nicolo-ribaudo
Copy link
Member

@barbalex The bug/fix is in @babel/plugin-transform-block-scoping

@barbalex
Copy link

@nicolo-ribaudo Thanks!
My project has not explicitely included @babel/plugin-transform-block-scoping so far. So I:

  • npm i --dev @babel/plugin-transform-block-scoping
  • added "@babel/plugin-transform-block-scoping": "7.20.9" as overrides to package.json

and the build works again!

Thanks so much for your effort and help!

@mccoinu
Copy link

mccoinu commented Dec 23, 2022

Hi I had the same problem,
First with the message:
TypeError: 'constantViolation' of undefined
then:
TypeError: Cannot set property 'kind' of undefined.

By setting
"@babel/core": "7.20.5"

I solved.

Thank you

@nicolo-ribaudo
Copy link
Member

@barbalex Now you can also remove it from your package.json! The process you did updated the your lockfile, and now that the lockfile is updated you won't get the old version anymore :)

@barbalex
Copy link

@nicolo-ribaudo Wow. The marvels of lockfiles. Glad to be helped by guys with more insight!

@reesscot
Copy link
Author

I can confirm that I'm no longer seeing the error after installing @babel/plugin-transform-block-scoping@7.20.9

@ndelangen
Copy link

Thank you @nicolo-ribaudo and everyone else that helped.

I wish I could have done more to help myself.

Really truly appreciative of the quick fixes, thank you.

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Mar 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants