0

我正在尝试安装“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 的 peer || 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"
  }
}

谁能帮我澄清一下?

4

1 回答 1

0

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

而 babel-loader 使用 webpack 作为对等依赖

很简单:安装 webpacknpm install webpack

于 2017-06-30T12:45:10.470 回答