【问题标题】:Babel not working with ES6 / Parser.pp.raiseBabel 不适用于 ES6 / Parser.pp.raise
【发布时间】:2016-03-15 00:20:58
【问题描述】:

当我尝试安装 babel 并让它工作时,所有这些错误都非常令人困惑,希望有人能提供帮助!

.babel_src

{
  "presets": ["es2015", "react", "stage-2"]
}

package.json

{
  "name": "testing-application",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "mocha './src/**/*.spec.js' --compilers js:babel-core/register"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.7.2",
    "babel-preset-es2015": "^6.6.0",
    "babel-preset-react": "^6.5.0",
    "babel-preset-stage-2": "^6.5.0",
    "except": "^0.1.3",
    "mocha": "^2.4.5",
    "react": "^0.14.7",
    "react-addons-test-utils": "^0.14.7",
    "react-dom": "^0.14.7"
  },
  "dependencies": {
    "react": "^0.14.7",
    "react-dom": "^0.14.7"
  }
}

我收到以下错误:

Unexpected token (3:20)
  1 | import except from 'except';
  2 | 
> 3 | describe('empty' () => {
    |                     ^
  4 |   it("should workd", () => {
  5 |     except(true).toEqual(true);
  6 |   })
    at Parser.pp.raise(/Users/tests/Documents/React-Redux-Applications/TestingApplication/node_modules/babel-core/node_modules/babylon/index.js:1378:13)

【问题讨论】:

    标签: mocha.js babeljs


    【解决方案1】:

    我在 ES6 代码中有错误!为错误道歉!

    【讨论】:

      猜你喜欢
      • 2016-04-24
      • 1970-01-01
      • 1970-01-01
      • 2017-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多