reactjs - 使用 create-react-app 时如何更新预先存在的依赖项?
问题描述
我正在使用create-react-app
一个项目。我安装了各种 eslint 插件等,但是,我们都知道 create-react-app 已经带有某些未在package.json
.
我想要eslint
目前是 5.3.0 的最新版本。Create-react-app 附带 5.16.0。没有弹出,我如何在不破坏一切的情况下将此依赖项带到最新版本?
我收到以下错误:
The react-scripts package provided by Create React App requires a dependency:
"eslint": "^5.16.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
:\node_modules\eslint (version: 5.3.0)
解决方案
我刚刚解决了这个问题,错误说:
The react-scripts package provided by Create React App requires a dependency:
"eslint": "5.16.0"
但也说你在 package.json 有另一个版本,
\node_modules\eslint (version: 5.3.0)
在我的情况下是 6.1.0
所以我的解决方案是:我搜索了名为 eslint 的依赖项,并更新了类似于"eslint": "^5.16.0"
在 package.json 中预期的 Create React App 的版本然后运行npm install
,现在你可以运行 npm start ... 如果你也遇到了slint-plugin-import
更新版本的问题。
推荐阅读
- php - 如何删除作为复合键存在于另一个中的主键
- python - 卷积神经网络的数据集组织
- postgresql - 使用 postgreSQL 迁移时遇到问题
- bash - 在 bash 脚本中创建多个终端并继续执行命令?
- nginx - 如何在 nginx 中的端口 443 上启用 grpc 而不会破坏 kubernetes 中端口 80 上的 http?
- html - 如何使用 css 为不同的分辨率设置 td 和 div 的宽度
- python - 使用 TF2.2 执行 TF1.X 代码会导致错误
- powershell - 值不出现在下一行
- javascript - Html5 视频标签 - 仅加载前几秒
- docker - Docker - Ubuntu 20.04 升级后没有路由到主机