[英]How to use babel6 with .babelrc
I'm hitting this example . 我正在打这个例子 。 I had cloned it and run
npm install
. 我克隆了它并运行
npm install
。
Then I try to run babel lib -d dist
, but I get ReferenceError: [BABEL] lib/index.js: Unknown option: /home/.../example-node-server/.babelrc.presets
. 然后我尝试运行
babel lib -d dist
,但是我得到了ReferenceError: [BABEL] lib/index.js: Unknown option: /home/.../example-node-server/.babelrc.presets
。
What's wrong? 怎么了? How can I properly transpile es6 code with babel6 and
.babelrc
using presets? 如何使用预设正确地使用babel6和
.babelrc
来转换es6代码?
To use babel
from the command line (not from your JavaScript code), install babel-cli
globally: 要从命令行使用
babel
(而不是从JavaScript代码中),请在全局安装babel-cli
:
npm install -g babel-cli
or locally: 或本地:
npm install babel-cli
In case of local install you can run it with: 如果是本地安装,您可以使用以下命令运行它:
./node_modules/.bin/babel
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.