简体   繁体   English

NPM的babel-cli问题

[英]babel-cli issues with npm

I am using babel to build a part of my library and I'm running into issues when i run babel commands through npm. 我正在使用babel构建我的库的一部分,当我通过npm运行babel命令时遇到了问题。

I have an npm script called build that calls: 我有一个名为build的npm脚本,该脚本调用:

{
  "prebuild": "rm -rf && mkdir dist",
  "build": "babel src/index.js -o dist/index.js"
}

I have run the actual babel command itself in my command line and it works. 我已经在命令行中运行了实际的babel命令,它可以工作。

However when I do npm run build from my command line it says 但是,当我从命令行运行npm运行build时,它说

The CLI has been moved into the package 'babel-cli'

npm also says that it is that specific line that is failing. npm还说是那条特定的线失败了。

I have already tried the following: 我已经尝试了以下方法:

  1. Restart my terminal. 重新启动我的终端。
  2. Install babel v5 because I read that v6 split a lot of its functionality. 安装babel v5是因为我读到v6拆分了许多功能。
  3. npm rebuild. npm重建。
  4. Delete my node_modules and npm install 删除我的node_modules和npm install

Any other ideas? 还有其他想法吗? as to why npm fails at running this command? 关于为什么npm运行此命令失败?

全局安装babel@5npm install babel@5 --global )以及本地npm install babel@5 --save-devnpm install babel@5 --save-dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM