{"id":19003,"library":"babel-install","title":"babel-install","description":"Declare and install Babel plugins and presets via CLI or programmatically. Current version 2.1.0. It automatically adds plugins/presets to .babelrc and installs npm packages, with shorthand CLI flags via yargs-parser. Warns on duplicate modules. Limited maintenance (last release 2016). Alternative to manual config edits for Babel 6.x era.","status":"maintenance","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/jameswomack/babel-install","tags":["javascript","babel","install","declare","babelrc","sync","merge","cli","programatically"],"install":[{"cmd":"npm install babel-install","lang":"bash","label":"npm"},{"cmd":"yarn add babel-install","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-install","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export; no named exports.","wrong":"const BabelInstaller = require('babel-install')","symbol":"BabelInstaller","correct":"import BabelInstaller from 'babel-install'"},{"note":"Must instantiate with BabelInstaller() first.","wrong":"BabelInstaller.installAndDeclare(plugins, callback)","symbol":"BabelInstaller.installAndDeclare","correct":"BabelInstaller().installAndDeclare(plugins, callback)"},{"note":"Both forms work; shorthand preferred for clarity.","wrong":"babel-install --presets es2015 --plugins transform-async-to-generator","symbol":"CLI","correct":"babel-install babel-preset-es2015 babel-plugin-transform-async-to-generator"}],"quickstart":{"code":"npm i babel-install -DE\nbabel-install --presets es2015 --plugins transform-async-to-generator transform-es2015-arrow-functions\ncat .babelrc\n# {\"presets\":[\"es2015\"],\"plugins\":[\"transform-es2015-arrow-functions\",\"transform-async-to-generator\"]}","lang":"javascript","description":"Install babel-install and use CLI to add presets/plugins to .babelrc and package.json."},"warnings":[{"fix":"Use @babel/core and manual configuration or tools like babel-preset-env.","message":"babel-install is only compatible with Babel 6.x; Babel 7+ uses @babel/ scoped packages and new config format.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use callback or wrap in promise; v1: BabelInstaller.installAndDeclare(plugins) (returns undefined).","message":"Programmatic API changed between v1 and v2. v1 used synchronous method; v2 uses callback.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always verify package names; use full names for non-standard packages.","message":"CLI shorthand with --plugins and --presets strips babel-plugin- and babel-preset- prefixes; may install wrong package if not careful.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm i babel-install -DE` in project root, then add `node_modules/.bin` to PATH or use npx babel-install.","cause":"Package not installed locally or globally. babel-install is installed as a devDependency but not linked.","error":"Error: Cannot find module 'babel-install'"},{"fix":"Run `export PATH=./node_modules/.bin:$PATH` or use `npx babel-install` instead.","cause":"Local bin not accessible; PATH does not include ./node_modules/.bin.","error":"babel-install: command not found"},{"fix":"Use `import BabelInstaller from 'babel-install'` then `BabelInstaller().installAndDeclare(...)`.","cause":"Using wrong import (named instead of default) or not calling BabelInstaller() as a function.","error":"TypeError: Cannot read property 'installAndDeclare' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}