我的项目的父文件夹中有另一个 node_module 文件夹。我将 react-script 更新为 v2,当我尝试启动项目时,出现如下错误:
The react-scripts package provided by Create React App requires a dependency:
"webpack": "4.19.1"
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:
/parent_dir/node_modules/webpack (version: 4.20.2)
但是,我的项目在这个目录中,并且有自己的 node_module 文件夹:
/parent_dir/my_project/node_modules/webpack (version: 4.20.2)
如果我删除父母的 node_modules,一切都会好起来的!