Laravel8 npm run dev outputs: ERESOLVE unable to resolve dependency tree
Goal
Avoid error message.
I have been getting the following error message when I run the command 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 [email protected] to update!
npm notice
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/acorn
npm ERR! acorn@"^7.0.0" from [email protected]
npm ERR! node_modules/acorn-node
npm ERR! acorn-node@"^1.6.1" from [email protected]
npm ERR! node_modules/detective
npm ERR! detective@"^5.2.0" from [email protected]
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 [email protected]
npm ERR! node_modules/terser
npm ERR! terser@"^5.9.0" from [email protected]
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 [email protected]
npm ERR! node_modules/terser-webpack-plugin
npm ERR! terser-webpack-plugin@"^5.2.4" from [email protected]
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
Quick Solution:
I can avoid the problem / error message with the following command:
npm install --legacy-peer-deps
.
Output:
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: 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
Question
What do I have to do to run npm install
again without getting the error message?
I have the same issue too. I have fixed it using this line
npm i acorn --dev
then run again
npm install && install run dev