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

[Bug]: path.requeueComputedKeyAndDecorators is not a function #16694

Closed
1 task
dep opened this issue Jul 29, 2024 · 4 comments · Fixed by #16695
Closed
1 task

[Bug]: path.requeueComputedKeyAndDecorators is not a function #16694

dep opened this issue Jul 29, 2024 · 4 comments · Fixed by #16695

Comments

@dep
Copy link

dep commented Jul 29, 2024

💻

  • Would you like to work on a fix?

How are you using Babel?

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

Input code

"devDependencies": {
"@apollo/react-testing": "^3.1.2",
"@babel/core": "7.24.9",
"@babel/eslint-parser": "7.25.1",
"@babel/plugin-proposal-optional-chaining": "7.21.0",
"@babel/preset-react": "7.24.7",
"@babel/preset-typescript": "^7.24.7",
}

Configuration file name

No response

Configuration

module.exports = {
  presets: [
    "@babel/preset-env",
    "@babel/preset-react",
    "@babel/preset-typescript",
  ],
  plugins: ["@babel/plugin-proposal-optional-chaining"],
};

Current and expected behavior

Current:

 FAIL  src/components/edit_revision/EditRevisionPage.test.js
  ● Test suite failed to run

    TypeError: /Box/applications/react/legacy/invoca-tags/src/components/edit_revision/EditRevisionPage.test.js: path.requeueComputedKeyAndDecorators is not a function

      at PluginPass.call (../../../../node_modules/@babel/traverse/src/visitors.ts:409:12)
      at PluginPass.call (../../../../node_modules/@babel/plugin-transform-async-generator-functions/src/index.ts:74:12)

Expected: Tests pass

Environment

  System:
    OS: macOS 14.5
  Binaries:
    Node: 20.4.0 - ~/.nvm/versions/node/v20.4.0/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 9.7.2 - ~/.nvm/versions/node/v20.4.0/bin/npm
  npmPackages:
    jest: 27.5.1 => 27.5.1
    webpack: 5.76.0 => 5.76.0

Possible solution

No response

Additional context

I've been chasing down Babel-related errors all day today. A couple others that I've been struggling with:

path.requeueComputedKeyAndDecorators is not a function

and

value.ensureFunctionName is not a function

All coming from babel libs. I'm assuming this is related to the 7.25.1 tag that was released just yesterday.

fix: ensureFunctionName may be undefined

Not sure why things are wonky today.

@babel-bot
Copy link
Collaborator

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

@JLHwung
Copy link
Contributor

JLHwung commented Jul 29, 2024

As a workaround, you can remove all @babel/* entries from the lock files and try install again. Or you can run yarn dedupe or npm dedupe, which depends on the package manager you use.

The culprit is that there are multiple @babel/traverse in the node_modules and the old babel/traverse can not provide the new babel/traverse method required by some plugins. If there are only one @babel/traverse copy, it should just work.

While we are trying our best to maintain compatibility issues between multiple Babel library versions, as a user running deduplicate on your dependencies can effectively help you dodge such issues.

@nicolo-ribaudo
Copy link
Member

That requeueComputedKeyAndDecorators is very interesting, since it comes from inside @babel/traverse which is the same package that defines the function (so it should be defined). Do you happen to have a repository that reproduces the problem?

@JLHwung
Copy link
Contributor

JLHwung commented Jul 29, 2024

@nicolo-ribaudo The path instance here was created by the old @babel/traverse (depended by the @babel/core), then we pass that path to the new @babel/traverse (depended by @babel/plugin-transform-async-generator-functions) 's visitors.environmentVisitor, so the Path.requeueComputedKeyAndDecorators is undefined.

Currently our e2e test can not catch such errors because we reduce every @babel/* version down to their earliest, which is still not duplicated. To catch this we will have to manually introduce different copies in node_modules.

I suggest we release a 7.25 update for @babel/core as well, so that it is easier for people to upgrade the root @babel/traverse.

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

Successfully merging a pull request may close this issue.

4 participants