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

Getting weird error - Use the babel-core package not babel. #5506

Closed
ORESoftware opened this issue Mar 19, 2017 · 11 comments
Closed

Getting weird error - Use the babel-core package not babel. #5506

ORESoftware opened this issue Mar 19, 2017 · 11 comments
Labels
Has PR i: question outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@ORESoftware
Copy link

ORESoftware commented Mar 19, 2017

Just wondering why I see this error:

Error: Use the `babel-core` package not `babel`.
    at Object.<anonymous> (/Users/alexamil/.suman/global/node_modules/babel-cli/index.js:1:69)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at /Users/alexamil/WebstormProjects/oresoftware/sumanjs/suman/lib/diagnostics/run-diagnostics.js:33:9
    at Array.forEach (native)

it's coming out of babel-cli

these are the only babel packages I am loading/requiring:

      'babel-cli': 'latest',
      'babel-core': 'latest',
      'babel-loader': 'latest',
      'babel-polyfill': 'latest',
      'babel-runtime': 'latest',
      'babel-register': 'latest',
      'babel-plugin-transform-runtime': 'latest',
      'babel-preset-es2015': 'latest',
      'babel-preset-es2016': 'latest',
      'babel-preset-react': 'latest',
      'babel-preset-stage-0': 'latest',
      'babel-preset-stage-1': 'latest',
      'babel-preset-stage-2': 'latest',
      'babel-preset-stage-3': 'latest',

seems like a weird error to me

@babel-bot
Copy link
Collaborator

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

@ORESoftware ORESoftware changed the title Getting weird error Getting weird error - Use the babel-core package not babel. Mar 19, 2017
@aaronang
Copy link
Member

This error message is returned when you import babel-cli: https://github.com/babel/babel/blob/d33d02359474296402b1577ef53f20d94e9085c4/packages/babel-cli/index.js.

@ORESoftware
Copy link
Author

@aaronang ok thanks, so I should not import babel-cli at all?

@aaronang
Copy link
Member

@ORESoftware Nope, you should import babel-core instead as the error message says 😄

@ORESoftware
Copy link
Author

ORESoftware commented Mar 19, 2017

Thanks, but it says "use babel-core instead of babel".

It does not say "use babel-core instead of babel-cli"

Right?

There used to be a babel module and there is a babel-cli module so the error message is confusing.

@ORESoftware
Copy link
Author

Sure, let me first verify that it works

@ORESoftware
Copy link
Author

Is there some documentation that shows that babel-cli is deprecated in favor of babel-core?

@aaronang
Copy link
Member

@ORESoftware I already made a PR for it. It is not deprecated, it is just not meant for use in a programmatic manner.

@ORESoftware
Copy link
Author

You mean it's for internal use and not for developers to install directly?

@aaronang
Copy link
Member

@ORESoftware It is meant for external use. In specific, the package enables developers to use the CLI: https://babeljs.io/docs/usage/cli/. So you do need it in package.json to be able to use CLI commands. However, you should not do something like import * from 'babel-cli' in your source code. That will result in the error you received.

@hzoo
Copy link
Member

hzoo commented Mar 20, 2017

babel-cli was never intended to be used programmatically, babel-cli is just a CLI tool that wraps babel-core. If you want to use babel in your own code you'll want to use babel-core. The error message is just saying babel probably since it's a legacy message from when there was just the babel package and no one else has reported this "error message typo"

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 5, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Has PR i: question 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