ReferenceError:[BABEL] src/app.js:未知选项

use*_*036 8 babel reactjs

我正在使用的babel版本 6.24.1 (babel-core 6.26.3)

我试图通过执行以下操作app.js从源代码自动生成脚本中的文件app.js

babel src/app.js --out-file=public/scripts/app.js --presets=env,react 我收到以下错误:

`ReferenceError: [BABEL] src/app.js: Unknown option: /home/my-pc/node_modules/react/index.js.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.

A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:

Invalid:
  `{ presets: [{option: value}] }`
Valid:
  `{ presets: [['presetName', {option: value}]] }`

For more detailed information on preset configuration, please see https://babeljs.io/docs/en/plugins#pluginpresets-options. (While processing preset: "/home/my-pc/node_modules/react/index.js")
`
Run Code Online (Sandbox Code Playgroud)

的package.json

{
  "name": "indecision-app",
  "version": "1.0.0",
  "main": "index.js",
  "author": "Sid",
  "license": "MIT",
  "dependencies": {
    "babel-preset-env": "1.5.2",
    "babel-preset-react": "6.24.1"
  }
}
Run Code Online (Sandbox Code Playgroud)