Home > OS >  Laravel8 npm run dev outputs: ERESOLVE unable to resolve dependency tree
Laravel8 npm run dev outputs: ERESOLVE unable to resolve dependency tree

Time:12-04

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 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

Quick Solution:

I can avoid the problem / error message with the following command: npm install --legacy-peer-deps.

Output:

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

Question

What do I have to do to run npm install again without getting the error message?

CodePudding user response:

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

CodePudding user response:

npm install npm@latest -g

then

npm install webpack-dev-server --save-dev

working for me

  • Related