Registry / devops / babel-install

babel-install

JSON →
library2.1.0jsnpmunverified

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.

npm install babel-install
INSTALL
IMPORT
SIG · BABEL-INSTALL
B
babel-install
devopsjavascriptv2.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BabelInstaller
import BabelInstaller from 'babel-install'
const BabelInstaller = require('babel-install')
Default export; no named exports.
BabelInstaller.installAndDeclare
BabelInstaller().installAndDeclare(plugins, callback)
BabelInstaller.installAndDeclare(plugins, callback)
Must instantiate with BabelInstaller() first.
CLI
babel-install babel-preset-es2015 babel-plugin-transform-async-to-generator
babel-install --presets es2015 --plugins transform-async-to-generator
Both forms work; shorthand preferred for clarity.

Install babel-install and use CLI to add presets/plugins to .babelrc and package.json.

npm i babel-install -DE babel-install --presets es2015 --plugins transform-async-to-generator transform-es2015-arrow-functions cat .babelrc # {"presets":["es2015"],"plugins":["transform-es2015-arrow-functions","transform-async-to-generator"]}
babel-install --version
Debug
Known issues
deprecatedbabel-install is only compatible with Babel 6.x; Babel 7+ uses @babel/ scoped packages and new config format.
fix
Use @babel/core and manual configuration or tools like babel-preset-env.
affects: >=1.0.0
breakingProgrammatic API changed between v1 and v2. v1 used synchronous method; v2 uses callback.
fix
Use callback or wrap in promise; v1: BabelInstaller.installAndDeclare(plugins) (returns undefined).
affects: >=2.0.0
gotchaCLI shorthand with --plugins and --presets strips babel-plugin- and babel-preset- prefixes; may install wrong package if not careful.
fix
Always verify package names; use full names for non-standard packages.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-install'
Package not installed locally or globally. babel-install is installed as a devDependency but not linked.
fix
Run `npm i babel-install -DE` in project root, then add `node_modules/.bin` to PATH or use npx babel-install.
babel-install: command not found
Local bin not accessible; PATH does not include ./node_modules/.bin.
fix
Run `export PATH=./node_modules/.bin:$PATH` or use `npx babel-install` instead.
TypeError: Cannot read property 'installAndDeclare' of undefined
Using wrong import (named instead of default) or not calling BabelInstaller() as a function.
fix
Use `import BabelInstaller from 'babel-install'` then `BabelInstaller().installAndDeclare(...)`.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Amazon
1
Resources
babel-install — npm install babel-install · libregistry