{"id":12867,"library":"babel-preset-es2015-node","title":"Babel Preset for ES2015 on Node","description":"This package, `babel-preset-es2015-node` (current version 6.1.1), is a Babel preset designed for Babel 6 projects to automatically apply only the necessary ES2015 (ES6) transformations for a given Node.js version. It inspects `process.version` at build time to determine which ES2015 features are already natively supported by the target Node.js environment (versions >=4.0.0 are supported) and avoids transpiling those, thus aiming for faster build and execution times by minimizing unnecessary transformations. It was part of the Babel 6 ecosystem, which has reached its end-of-life. It has since been largely superseded by `@babel/preset-env`, which offers more flexible and powerful target-specific transpilation across various environments, including different Node.js versions. The package itself is not actively maintained and its usage is highly discouraged for new projects or existing projects migrating to Babel 7+ or later Node.js versions.","status":"abandoned","version":"6.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/rtsao/babel-preset-es2015-node","tags":["javascript"],"install":[{"cmd":"npm install babel-preset-es2015-node","lang":"bash","label":"npm"},{"cmd":"yarn add babel-preset-es2015-node","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-preset-es2015-node","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This preset internally relies on and configures plugins from `babel-preset-es2015` based on the detected Node.js version.","package":"babel-preset-es2015","optional":false},{"reason":"Required as a peer dependency for Babel 6 applications to enable the Babel API and transformations.","package":"babel-core","optional":true},{"reason":"Required as a peer dependency for Babel 6 to use Babel from the command line.","package":"babel-cli","optional":true}],"imports":[{"note":"This preset is loaded by its name 'es2015-node' in Babel 6 configuration files (.babelrc). Modern Babel 7+ presets use `@babel/` scoped packages.","wrong":"{\n  \"presets\": [\"@babel/preset-es2015-node\"]\n}","symbol":"Preset in .babelrc","correct":"{\n  \"presets\": [\"es2015-node\"]\n}"},{"note":"For command-line usage with Babel 6, the preset name is passed directly without the `@babel/` scope.","wrong":"babel script.js --presets @babel/preset-es2015-node","symbol":"CLI usage","correct":"babel script.js --presets es2015-node"},{"note":"When using Babel 6's Node API, `babel-core` is required, and the preset is referenced by its simple name. For Babel 7+, `@babel/core` and scoped preset names would be used.","wrong":"require(\"@babel/core\").transform(\"code\", {\n  presets: [\"@babel/preset-es2015-node\"]\n});","symbol":"Node API usage","correct":"require(\"babel-core\").transform(\"code\", {\n  presets: [\"es2015-node\"]\n});"}],"quickstart":{"code":"{\n  \"presets\": [\"es2015-node\"]\n}\n\n// To use, first install:\n// npm install --save-dev babel-cli babel-preset-es2015-node\n\n// Then run Babel from your terminal:\n// npx babel your-source-file.js --out-file your-compiled-file.js --presets es2015-node\n\n// Or, via a Node.js script using the Babel 6 API:\n// const babel = require('babel-core');\n// const code = `const greeting = (name) => { console.log(`Hello, ${name}!`); };`;\n// const result = babel.transform(code, {\n//   presets: ['es2015-node']\n// });\n// console.log(result.code);","lang":"json","description":"Demonstrates the recommended way to configure `babel-preset-es2015-node` via a `.babelrc` file, along with CLI and Node API examples for Babel 6 environments."},"warnings":[{"fix":"Migrate your Babel setup to Babel 7+ and use `@babel/preset-env` with a `targets.node` configuration. For example: `{ \"presets\": [[\"@babel/preset-env\", { \"targets\": { \"node\": \"current\" } }]] }`","message":"This preset is strictly compatible with Babel 6. It will not work with Babel 7 or newer versions due to breaking changes in Babel's architecture, package naming (`@babel/scope`), and preset resolution.","severity":"breaking","affected_versions":">=7.0.0 (Babel)"},{"fix":"Replace `babel-preset-es2015-node` with `@babel/preset-env`. This modern preset provides superior target-specific transpilation.","message":"The `babel-preset-es2015` preset, which this package is based on, has been deprecated in favor of `@babel/preset-env`. This also makes `babel-preset-es2015-node` effectively deprecated and abandoned.","severity":"deprecated","affected_versions":">=6.1.1"},{"fix":"While `babel-preset-es2015-node` is abandoned, `@babel/preset-env` allows explicit configuration of target Node.js versions (e.g., `\"node\": \"14\"`) or using a `.browserslistrc` file for consistent targeting.","message":"The preset relies on `process.version` at build time to determine Node.js capabilities. If your build environment's Node.js version differs from your target deployment environment, you may experience incorrect transpilation (e.g., transpiling features natively supported by the deployment environment, or failing to transpile features not supported).","severity":"gotcha","affected_versions":">=6.1.1"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure the package is installed: `npm install --save-dev babel-preset-es2015-node`.","cause":"The `babel-preset-es2015-node` package has not been installed or is not resolvable in the project's `node_modules`.","error":"Error: Cannot find preset 'es2015-node' relative to directory ..."},{"fix":"Verify that `babel-preset-es2015-node` is correctly listed in your `.babelrc` or CLI options and that Babel 6 is correctly invoked. For modern projects, switch to `@babel/preset-env` for full ESNext feature support.","cause":"This usually indicates that the Babel configuration is not correctly applying the necessary transformations, often because the `babel-preset-es2015-node` preset is not being used, or Babel 6 is being used with code that requires Babel 7+ transformations.","error":"SyntaxError: Unexpected token import (or other modern syntax error)"},{"fix":"Add `\"presets\": [\"es2015-node\"]` to your `.babelrc` file or use `--presets es2015-node` in the CLI. Alternatively, if using Babel 7+, install and configure `@babel/preset-env`.","cause":"Babel 6 requires explicit presets or plugins to be configured; it does nothing by default. The preset is missing from the configuration.","error":"You gave us a main.js, but it doesn't contain a preset or plugin to use!"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null}