Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 反应0.14错误:模块生成失败:引用错误:[BABEL]…/node_modules/eslint loader/index.js!//main.jsx:未知选项:base.stage_Reactjs_Eslint - Fatal编程技术网

Reactjs 反应0.14错误:模块生成失败:引用错误:[BABEL]…/node_modules/eslint loader/index.js!//main.jsx:未知选项:base.stage

Reactjs 反应0.14错误:模块生成失败:引用错误:[BABEL]…/node_modules/eslint loader/index.js!//main.jsx:未知选项:base.stage,reactjs,eslint,Reactjs,Eslint,这是my package.json: "scripts": { "test": "echo \"Error: no test specified\n\" && exit 1", "lint": "npm run lint-js && npm run lint-css", "lint-js": "echo \"\\033[33mLinting JS\\033[0m\n\" && eslint . --ext .js --e

这是my package.json:

  "scripts": {
    "test": "echo \"Error: no test specified\n\" && exit 1",
    "lint": "npm run lint-js && npm run lint-css",
    "lint-js": "echo \"\\033[33mLinting JS\\033[0m\n\" && eslint . --ext .js --ext .jsx",
    "lint-css": "echo \"\\033[33mLinting CSS\\033[0m\n\" && csslint app/style --quiet",
    "start": "echo \"\\033[33mStarting dev server at localhost:8080\\033[0m\n\" && TARGET=dev webpack-dev-server --devtool eval-source --progress --colors --hot --inline --history-api-fallback",
    "compile": "echo \"\\033[33mBuilding for production\\033[0m\n\" && TARGET=build webpack -p",
    "build": "npm run lint-js && npm run lint-css && npm run compile"
  },
  "private": true,
  "dependencies": {
    "alt": "^0.17.8",
    "babel-core": "^6.1.2",
    "babel-loader": "^6.1.0",
    "babelify": "^7.2.0",
    "css-loader": "^0.22.0",
    "csslint": "^0.10.0",
    "csslint-loader": "^0.2.1",
    "eslint": "^1.9.0",
    "eslint-plugin-react": "^3.8.0",
    "file-loader": "^0.8.4",
    "flowcheck": "^0.2.7",
    "flowcheck-loader": "^1.0.0",
    "gsap": "^1.18.0",
    "html-webpack-plugin": "^1.6.2",
    "jquery-browserify": "^1.8.1",
    "node-libs-browser": "^0.5.3",
    "radium": "^0.14.3",
    "react": "^0.14.2",
    "react-bootstrap": "^0.27.3",
    "react-bootstrap-modal": "^2.0.0",
    "react-dom": "^0.14.2",
    "react-hot-loader": "^1.3.0",
    "react-odometer": "0.0.1",
    "react-slick": "^0.9.1",
    "react-swf": "^0.13.0",
    "style-loader": "^0.13.0",
    "superagent": "^1.4.0",
    "url-loader": "^0.5.6",
    "video.js": "^5.0.2",
    "webpack": "^1.12.3",
    "webpack-dev-server": "^1.12.1",
    "webpack-merge": "^0.2.0"
  }
}
这是完整的错误信息,我读到这个错误可以用babelify解决,所以我添加了它,虽然我不需要它

在./app中出错/

main.jsx
Module build failed: ReferenceError: [BABEL] /Dev/Fanatico/node_modules/eslint-loader/index.js!/Dev/Fanatico/app/main.jsx: Unknown option: base.stage
    at Logger.error (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/logger.js:43:11)
    at OptionManager.mergeOptions (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/options/option-manager.js:245:18)
    at OptionManager.init (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/options/option-manager.js:396:10)
    at File.initOptions (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/index.js:191:75)
    at new File (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/index.js:122:22)
    at Pipeline.transform (/Dev/Fanatico/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
    at transpile (/Dev/Fanatico/node_modules/babel-loader/index.js:14:22)
    at Object.module.exports (/Dev/Fanatico/node_modules/babel-loader/index.js:83:14)
 @ multi main

这一切都是从我想升级到React 0.14开始的,最后一个接一个地安装所有软件包。

您使用的是巴贝尔6,它不再有舞台选项,而是必须使用预设,例如:

装置

$npm安装babel-preset-stage-0

用法

将以下行添加到.babelrc文件中:

{“预设”:[“阶段-0”]}


注意:您还需要
es2015
react
预设。还请注意,至少一些热重新加载插件尚不兼容。

您需要安装:

  • 巴别塔核心
  • 巴别塔装载机
  • babel-preset-es2015
  • 巴别塔预设反应
  • 巴别塔-预设-舞台-0
您的包.json中的依赖项将是:

{
  "name": "react-transform-example",
  "devDependencies": {
    "babel-core": "^6.0.20",
    "babel-loader": "^6.0.1",
    "babel-preset-es2015": "^6.0.15",
    "babel-preset-react": "^6.0.15",
    "babel-preset-stage-0": "^6.0.15",
    "express": "^4.13.3",
    "webpack": "^1.9.6"
  },
  "dependencies": {
    "react": "^0.14.0",
    "react-dom": "^0.14.0"    
  }
}
以及您的.babelrc文件

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

更多信息请访问

您是否正在使用webpack?