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 'buildError' of undefined #8689

Closed
yiye opened this issue Sep 12, 2018 · 8 comments
Closed

TypeError: Cannot read property 'buildError' of undefined #8689

yiye opened this issue Sep 12, 2018 · 8 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@yiye
Copy link

yiye commented Sep 12, 2018

Bug Report

Current Behavior
A clear and concise description of the behavior.
image

Input Code

  • REPL or Repo link if applicable:
TypeError: Cannot read property 'buildError' of undefined
    at Scope.checkBlockScopedCollisions (/Users/puss/work/ioc/parrot-tool-must/node_modules/_@babel_traverse@7.0.0@@babel/traverse/lib/scope/index.js:347:22)
    at Scope.registerBinding (/Users/puss/work/ioc/parrot-tool-must/node_modules/_@babel_traverse@7.0.0@@babel/traverse/lib/scope/index.js:504:16)
    at Scope.registerDeclaration (/Users/puss/work/ioc/parrot-tool-must/node_modules/_@babel_traverse@7.0.0@@babel/traverse/lib/scope/index.js:452:14)
    at Object.Declaration (/Users/puss/work/ioc/parrot-tool-must/node_modules/_@babel_traverse@7.0.0@@babel/traverse/lib/scope/index.js:125:12)
    at NodePath._call (/Users/puss/work/ioc/parrot-tool-must/node_modules/_@babel_traverse@7.0.0@@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/puss/work/ioc/parrot-tool-must/node_modules/_@babel_traverse@7.0.0@@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/puss/work/ioc/parrot-tool-must/node_modules/_@babel_traverse@7.0.0@@babel/traverse/lib/path/context.js:88:12)
    at TraversalContext.visitQueue (/Users/puss/work/ioc/parrot-tool-must/node_modules/_@babel_traverse@7.0.0@@babel/traverse/lib/context.js:118:16)
    at TraversalContext.visitMultiple (/Users/puss/work/ioc/parrot-tool-must/node_modules/_@babel_traverse@7.0.0@@babel/traverse/lib/context.js:85:17)
    at TraversalContext.visit (/Users/puss/work/ioc/parrot-tool-must/node_modules/_@babel_traverse@7.0.0@@babel/traverse/lib/context.js:144:19)

Environment

  • Babel version(s): [v7.0.0]
  • Node/npm version: [Node v10.9.0/npm 5.15.0]
  • OS: [e.g. OSX 10.13.6]
  • Monorepo [e.g. yes/no/Lerna]
  • How you are using Babel: [AST parser]
    .
@babel-bot
Copy link
Collaborator

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

@loganfsmyth
Copy link
Member

This may be a duplicate, but it's hard to tell without a full reproduction example. What config and input source are you using to produce this error? How are you calling Babel? It would be great if you could provide a repository that reproduces the error.

@chrisregnier
Copy link

I'm getting the same thing where hub isn't defined.
Here's the rough outline of what I'm doing.

let code = `
  function foo(v) {
    let v = 8
  }
`;
let ast = parse(code, {
  sourceType: 'module',
  sourceFilename: 'failingTest',
  ranges: true,
  plugins: [
    'jsx',
    'flow',
    'classProperties',
    'objectRestSpread'
  ]
})
traverse(ast, {
  Program(path) {
    console.log('here')
  }
}, null, { stateData: {} });

@chrisregnier
Copy link

ya this looks like a duplicate of #8262 , although I don't t think it needs to be typescript.

@loganfsmyth
Copy link
Member

Cool, this is actually a duplicate of #8617. That other one is triggering the same broken code, but that other one isn't supposed to trigger an error in the first place.

@loganfsmyth
Copy link
Member

And to clarify, #8617 is what is causing your code snippet to throw an unhelpful error message, but your example code is a valid error, just to clarify, in case you wanted it to not throw.

@chrisregnier
Copy link

ya I believe they all have the same cause. Looks like hub isn't initialized in our case in the root path so when context.create tries to grab it recursively from the parentPath, nothing's there. I've gotten the error here and the one in 8262 for the same reason, but with slightly different test code.

@loganfsmyth
Copy link
Member

Yup, I mostly clarify because for #8262 it is different because it actually shouldn't be a "Duplicate declaration" in the first place.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 15, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Dec 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

4 participants