{"id":18980,"library":"babel-cli","title":"babel-cli","description":"Babel command line interface for transpiling JavaScript files using Babel 6. Latest stable version is 6.26.0 (no longer actively developed). This package is part of the legacy Babel 6 ecosystem and has been superseded by @babel/cli in Babel 7+. Key differentiators: provides CLI tools like babel, babel-node, and babel-external-helpers. No further releases expected; users should migrate to @babel/cli for Babel 7+.","status":"deprecated","version":"6.26.0","language":"javascript","source_language":"en","source_url":"https://github.com/babel/babel/tree/master/packages/babel-cli","tags":["javascript","6to5","babel","es6","transpile","transpiler","babel-cli","compiler"],"install":[{"cmd":"npm install babel-cli","lang":"bash","label":"npm"},{"cmd":"yarn add babel-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-cli","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core Babel compiler required for transpilation","package":"babel-core","optional":false},{"reason":"File watching for --watch flag","package":"chokidar","optional":true}],"imports":[{"note":"Use npx or install locally; global install is discouraged.","wrong":"babel script.js (requires global install)","symbol":"CLI command","correct":"npx babel script.js"},{"note":"babel-node is a CLI tool, not a library import.","wrong":"node script.js (without transpilation)","symbol":"babel-node","correct":"npx babel-node script.js"},{"note":"Generates a file with helper functions for external use.","wrong":"","symbol":"babel-external-helpers","correct":"npx babel-external-helpers"}],"quickstart":{"code":"// Install babel-cli and a preset\nnpm install --save-dev babel-cli babel-preset-env\n\n// Create .babelrc\n{\n  \"presets\": [\"env\"]\n}\n\n// Transpile a file\nnpx babel input.js --out-file output.js\n\n// Watch mode\nnpx babel input.js --watch --out-file output.js\n\n// Run with babel-node (ES6 support)\nnpx babel-node -e \"console.log([1,2,3].map(x => x*2))\"","lang":"javascript","description":"Shows typical usage: install, configure preset, transpile files, use watch mode, and run scripts with babel-node."},"warnings":[{"fix":"Migrate to @babel/cli and @babel/core (Babel 7+): npm install --save-dev @babel/cli @babel/core @babel/preset-env","message":"babel-cli is deprecated in favor of @babel/cli. No new features or bug fixes.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Use @babel/preset-env instead of babel-preset-env, @babel/plugin-* instead of babel-plugin-*. Check Babel 7 migration guide.","message":"Babel 6 to 7 breaks compatibility: presets/plugins renamed, AST changes, CLI options changed.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Install both: npm install --save-dev babel-cli babel-core","message":"Requires babel-core to be installed separately (not a dependency of babel-cli).","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Pre-compile code for production, or use ts-node-like alternatives.","message":"babel-node is not suitable for production use due to memory leaks and startup delay.","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Use babel-preset-env and configure targets.","message":"babel-preset-env replaces babel-preset-es2015, es2016, etc. in Babel 6+.","severity":"deprecated","affected_versions":">=6.15.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install --save-dev babel-cli babel-core","cause":"babel-cli depends on babel-core as a peer dependency but does not install it automatically.","error":"Error: Cannot find module 'babel-core'"},{"fix":"Add babel-plugin-transform-runtime or include babel-polyfill: npm install --save-dev babel-plugin-transform-runtime and add plugin to .babelrc","cause":"Using async/await without Babel's runtime polyfill.","error":"ReferenceError: regeneratorRuntime is not defined"},{"fix":"Uninstall babel-cli and install @babel/cli @babel/core: npm uninstall babel-cli && npm install --save-dev @babel/cli @babel/core","cause":"Mixing Babel 6 CLI with Babel 7 core packages accidentally.","error":"Error: Requires Babel \"7\", but was loaded with \"6.x\""},{"fix":"Use npx babel or add node_modules/.bin to PATH, or install globally: npm install -g babel-cli","cause":"babel-cli is not installed globally or local node_modules/.bin is not in PATH.","error":"babel: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}