babel-loader@7.1.2 需要 webpack@2 的 peer ||3 但没有安装 [英] babel-loader@7.1.2 requires a peer of webpack@2 || 3 but none was installed

查看:384
本文介绍了babel-loader@7.1.2 需要 webpack@2 的 peer ||3 但没有安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在安装所有 node_modules 时遇到了这个问题.这让我发疯.

I am having this issue while installing all node_modules. And this is making me crazy.

babel-loader@7.1.2 需要 webpack@2 的 peer ||3 但没有已安装.

babel-loader@7.1.2 requires a peer of webpack@2 || 3 but none was installed.

这是我的 package.json 文件

Here is my package.json file

{
  "name": "react-router-firebase-auth",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "react-scripts": "0.9.5"
  },
  "dependencies": {
    "@atlaskit/button": "3.0.0",
    "@atlaskit/css-reset": "1.1.4",
    "@atlaskit/field-text": "4.0.1",
    "@atlaskit/modal-dialog": "2.1.1",
    "@atlaskit/page": "4.0.1",
    "@atlaskit/util-shared-styles": "2.3.1",
    "@shopify/polaris": "^1.5.1",
    "babel-eslint": "^7.0.0",
    "bootstrap": "^3.3.7",
    "eslint": "3.16.1",
    "eslint-plugin-react": "6.4.1",
    "express": "^4.16.1",
    "firebase": "^4.5.0",
    "firebase-admin": "^5.4.1",
    "firestore": "^1.1.6",
    "fixed-data-table": "^0.6.4",
    "griddle-react": "^1.8.1",
    "jquery": "^3.2.1",
    "node-localstorage": "^1.3.0",
    "nodemon": "^1.12.1",
    "react": "^15.5.3",
    "react-bootstrap": "^0.31.3",
    "react-bootstrap-button-loader": "^1.0.8",
    "react-bootstrap-navbar": "^1.1.0",
    "react-data-grid": "^2.0.59",
    "react-date-picker": "^6.1.2",
    "react-dom": "^15.5.3",
    "react-fontawesome": "^1.6.1",
    "react-router-dom": "^4.0.0-beta.8",
    "react-scripts": "^0.9.5",
    "react-transition-group": "^1.2.0",
    "reactstrap": "^4.8.0",
    "requestify": "^0.2.5",
    "simple-react-bootstrap": "^0.2.7",
    "styled-components": "1.4.6",
    "url": "^0.11.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

我正在为这个项目使用 create-react-app.所以我无法更改 webpack.config.js 文件.我应该在这里做什么?

I am using create-react-app for this project. So i could not change webpack.config.js file. What am i supposed to do here?

推荐答案

请阅读这篇文章.它描述了什么是对等依赖.

Please read this post. It describes what a peer dependency is.

https://stackoverflow.com/a/34645112/2379376

这意味着您根本没有安装 webpack,或者您安装了不同的版本 (webpack 1.x).但是这个插件需要版本 2 或 3 的 webpack 才能正常运行.

What that means is that you have webpack not installed at all or you have a different version (webpack 1.x) installed. But this plugin needs webpack in version 2 or 3 to function properly.

你能做的是

npm install webpack -g

因此 npm 将在您的系统上安装最新版本的 webpack.但是现在当其他加载器需要旧版本的 webpack 时,可能会出现其他对等警告.

So npm will install the newest version of webpack on your system. But now other peer warnings could occur when other loaders need an older version of webpack.

这篇关于babel-loader@7.1.2 需要 webpack@2 的 peer ||3 但没有安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆