当我尝试安装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)
答案 0 :(得分:0)
我在ES6代码中出错了!抱歉错了!