Laravel8 npm运行dev输出:ERESOLVE无法解析依赖树



目标

避免出现错误消息。当我运行命令npm run dev:时,我收到了以下错误消息

npm notice 
npm notice New major version of npm available! 7.6.1 -> 8.1.4
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.1.4
npm notice Run npm install -g npm@8.1.4 to update!
npm notice 
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: acorn@7.4.1
npm ERR! node_modules/acorn
npm ERR!   acorn@"^7.0.0" from acorn-node@1.8.2
npm ERR!   node_modules/acorn-node
npm ERR!     acorn-node@"^1.6.1" from detective@5.2.0
npm ERR!     node_modules/detective
npm ERR!       detective@"^5.2.0" from tailwindcss@2.2.19
npm ERR!       node_modules/tailwindcss
npm ERR!         dev tailwindcss@"^2.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional acorn@"^8.5.0" from terser@5.10.0
npm ERR! node_modules/terser
npm ERR!   terser@"^5.9.0" from laravel-mix@6.0.39
npm ERR!   node_modules/laravel-mix
npm ERR!     dev laravel-mix@"^6.0.6" from the root project
npm ERR!   terser@"^5.7.2" from terser-webpack-plugin@5.2.5
npm ERR!   node_modules/terser-webpack-plugin
npm ERR!     terser-webpack-plugin@"^5.2.4" from laravel-mix@6.0.39
npm ERR!     node_modules/laravel-mix
npm ERR!       dev laravel-mix@"^6.0.6" from the root project
npm ERR!     1 more (webpack)
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/ml/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ml/.npm/_logs/2021-12-02T07_41_55_149Z-debug.log

快速解决方案:

我可以使用以下命令避免出现问题/错误消息:CCD_ 2。

输出:

npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
added 807 packages, and audited 808 packages in 12s
84 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities

问题

我必须做些什么才能再次运行npm install而不收到错误消息?

我也有同样的问题。我已经用这条线修复了它

npm i acorn—开发

然后再次运行

npm安装&安装运行开发

npm安装npm@latest-g

然后

npm安装webpack开发服务器--保存开发

为我工作

如果您在任何Vagrant环境中使用Laravel Homestead Package,请不要在Vagrant项目目录中运行该命令。转到项目的本地目录并运行这些命令。漫游内部命令的图像

您应该在以下位置运行:漫游外的命令图像

最新更新