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

Comments

Projects
None yet
4 participants
@yiye

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

This comment has been minimized.

Show comment
Hide comment
@babel-bot

babel-bot Sep 12, 2018

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.

Collaborator

babel-bot commented Sep 12, 2018

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

This comment has been minimized.

Show comment
Hide comment
@loganfsmyth

loganfsmyth Sep 12, 2018

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.

Member

loganfsmyth commented Sep 12, 2018

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

This comment has been minimized.

Show comment
Hide comment
@chrisregnier

chrisregnier Sep 15, 2018

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 commented Sep 15, 2018

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

This comment has been minimized.

Show comment
Hide comment
@chrisregnier

chrisregnier Sep 15, 2018

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

chrisregnier commented Sep 15, 2018

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

@loganfsmyth

This comment has been minimized.

Show comment
Hide comment
@loganfsmyth

loganfsmyth Sep 15, 2018

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.

Member

loganfsmyth commented Sep 15, 2018

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

This comment has been minimized.

Show comment
Hide comment
@loganfsmyth

loganfsmyth Sep 15, 2018

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.

Member

loganfsmyth commented Sep 15, 2018

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

This comment has been minimized.

Show comment
Hide comment
@chrisregnier

chrisregnier Sep 15, 2018

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.

chrisregnier commented Sep 15, 2018

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

This comment has been minimized.

Show comment
Hide comment
@loganfsmyth

loganfsmyth Sep 15, 2018

Member

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

Member

loganfsmyth commented Sep 15, 2018

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

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