mxk*_*aus 6 javascript babeljs
快速提问。找到了类似的案例,但它们对我不起作用。
按照本指南https://babeljs.io/docs/setup/#installation我正在尝试安装 Babel Cli。
但是从 package.json 中的命令运行 babel 配置如下
"scripts": {
"build": "babel src -d lib"
},
Run Code Online (Sandbox Code Playgroud)
抛出错误
> babel src -d lib
src doesn't exist
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! my-package@1.0.0 build: `babel src -d lib`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the my-package@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
npm ERR! A complete log of this run can be found in:
Run Code Online (Sandbox Code Playgroud)
运行命令时 npm run build
我已经安装babel-preset-env并配置了一个.babelrc
npm 版本 6.1.0
你知道src doesn't exist从哪里来吗?谢谢!
src是包含要转换的文件的文件夹。创建它并将您的文件移动到那里或更新命令以使用包含您的文件的文件夹。
更多信息:https : //babeljs.io/docs/usage/cli/#compile-directories
| 归档时间: |
|
| 查看次数: |
4660 次 |
| 最近记录: |