create-react-app webpack与第三方webpack冲突

时间:2020-05-12 19:29:03

标签: javascript webpack create-react-app cesium craco

我有一个使用最新版本的create-react-app创建的项目(ATTOW 3.4.1),并安装了craco-铯,craco和铯最新版本。这些是用于地球可视化的第三方库。

"@craco/craco": "^5.6.2",
"@hot-loader/react-dom": "^16.11.0",
"cesium": "^1.64.0",
"craco-cesium": "^1.2.0",
"craco-plugin-react-hot-reload": "^0.1.0",
"react": "^16.12.0",
"react-dom": "16.12.0",
"react-hot-loader": "^4.12.18",
"react-scripts": "3.3.0",
"resium": "^1.10.0"

当我运行项目npm run start时,显示以下错误:

> test@0.1.0 start /home/bob/create-react-app-cesium-example-master
> craco start


There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The react-scripts package provided by Create React App requires a dependency:

  "webpack": "4.41.2"

Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:

  /home/bob/create-react-app-cesium-example-master/node_modules/webpack (version: 4.43.0) 

运行npm ls webpack时出现冲突:

test@0.1.0 /home/bob/create-react-app-cesium-example-master
├─┬ craco-cesium@1.2.0
│ └── UNMET PEER DEPENDENCY webpack@4.43.0 
└─┬ react-scripts@3.3.0
  └── webpack@4.41.2 

npm ERR! peer dep missing: webpack@^2.0.0, required by strip-pragma-loader@1.0.0

我是从头开始创建的,但是有一个带有裸露骨骼设置的仓库,它也显示了发生的错误: https://github.com/rot1024/create-react-app-cesium-example

出了什么问题?并且我想分叉并修复并提出请求,但需要在本地测试更新,如何在项目中包含此源?

0 个答案:

没有答案