我不确定该怎么办,因为每次我使用create_react_app
它都会这样做
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
即使我已经检查了全局安装位置中已经存在react, react-dom, and react-scripts
包。
如何阻止create_react_app
重新安装全局安装的软件包?
>create_react_app
使用npm
,对于 npm 包,仅当它提供从 shell (CLI( 运行的可执行命令时,才应全局安装它。 这是 npm 将所有应用程序包保留在node_modules以避免冲突的方式,如果您以前使用过 NPM 之类的东西,那么 npm 与 bundler 之类的东西相比是不同的。 所以简单的答案是 npm 的正确方式,甚至不需要更改如果这可能看起来像是浪费资源