使用汇总时UNMET PEER DEPENDENCY webpack

时间:2017-06-29 07:42:33

标签: webpack dependencies rollup react-dnd babel-loader

我正在尝试安装'react-dnd'并获取:

  

+ - react-dnd@2.4.0` - UNMET PEER DEPENDENCY webpack @ 1 || 2 || ^ 2.1.0-beta || ^ 2.2.0-RC

     

npm WARN babel-loader@6.4.1需要webpack @ 1 ||的同行2 ||   ^ 2.1.0-beta || ^ 2.2.0-rc但没有安装。

我的项目使用汇总而不是webpack,我不知道如何处理这个问题。 我的npm版本:4.1.2 我的package.json:

{
  "name": "newx",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^15.4.2",
    "react-dnd": "^2.4.0",
    "react-dnd-html5-backend": "^2.4.1",
    "react-dom": "^15.4.2",
    "react-redux": "^5.0.0",
    "redux": "^3.6.0"
  },
  "devDependencies": {
    "babel-core": "^6.25.0",
    "babel-plugin-external-helpers": "^6.22.0",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.0.15",
    "babel-plugin-transform-react-constant-elements": "^6.0.14",
    "babel-plugin-transform-runtime": ">= 6.8.0",
    "babel-preset-env": "^1.2.2",
    "babel-preset-es2015": "^6.0.15",
    "babel-preset-react": "^6.0.15",
    "babel-preset-stage-2": "^6.24.1",
    "chalk": "^1.1.3",
    "express": "^4.15.2",
    "fs-extra": "^0.30.0",
    "minimatch": "^3.0.3",
    "mkdirp": "^0.5.1",
    "ncp": "^2.0.0",
    "node-getopt": "^0.2.3",
    "node-notifier": "^5.0.2",
    "node-sass": "^4.5.0",
    "prop-types": "^15.5.10",
    "rollup": "^0.41.6",
    "rollup-plugin-babel": "^2.7.1",
    "rollup-plugin-commonjs": "^8.0.2",
    "rollup-plugin-node-globals": "^1.1.0",
    "rollup-plugin-node-resolve": "^2.0.0",
    "rollup-plugin-replace": "^1.1.1",
    "rollup-plugin-uglify": "^1.0.1",
    "rollup-pluginutils": "^1.3.1",
    "uglify-js": "github:mishoo/UglifyJS2#harmony"
  },
  "scripts": {
    "build": "node scripts/rollup-watch.js",
    "build-release": "node scripts/rollup-watch.js --release --rebuild",
    "watch": "node scripts/rollup-watch.js --watch",
    "dev-server": "node scripts/dev-server.js"
  }
}

任何人都可以帮我澄清一下吗?

1 个答案:

答案 0 :(得分:0)

你有这个错误,因为react-dnd使用babel-loader。您可以在react-dnd的yarn.lock文件中看到它。

babel-loader使用webpack作为peer dependency

如此简单:使用npm install webpack

安装webpack