Laravel8 npm run dev outputs: ERESOLVE unable to resolve dependency tree - laravel

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?

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

npm install npm#latest -g
then
npm install webpack-dev-server --save-dev
working for me

If you are using Laravel Homestead Package for any Vagrant Environment, then don't run the command inside the Vagrant Project Directory.
Go outside to the local directory of the project and run these commands.
image of commands inside vagrant
You should run these here::
image of commands outside vagrant

Related

why instaling type-graphql, #apollo/server and graphql together showing dependency error

I have been trying to install typegraphql with apollo/server in typescript node template but it showing dependency error, I don't know why all new version is not compatible with each other.
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: server#1.0.0
npm ERR! Found: graphql#16.6.0
npm ERR! node_modules/graphql
npm ERR! graphql#"*" from the root project
npm ERR! peer graphql#"^16.6.0" from #apollo/server#4.3.0
npm ERR! node_modules/#apollo/server
npm ERR! #apollo/server#"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! type-graphql#"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: graphql#15.8.0
npm ERR! node_modules/graphql
npm ERR! peer graphql#"^15.3.0" from type-graphql#1.1.1
npm ERR! node_modules/type-graphql
npm ERR! type-graphql#"*" from the root project
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 i #apollo/server express graphql reflect-metadata type-graphql
should forcing it works or will it lead to data-leaks and all?
Thanks in advance for replying
The most recent version of type-graphql only works with graphql version ^15.5.0. Almost all newer versions of #apollo/server and graphql-related libraries, on the other hand, only support graphql version >= 16.
Fortunately, a newer version of type-graphql (version 2.0.0), which is still in beta, is available under the next tag version in npm.
To install it, first uninstall type-graphql and then reinstall it specifying the next tag:
npm uninstall type-graphql
npm install type-graphql#next
PS: If you want to look at a working example project, check out this.

Laravel 9 Install vue router for vue 2.6.12

I try installing vue router with run command "npm install vue-router" but then showing error like this:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: vue#2.6.14
npm ERR! dev vue#"^2.6.12" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^3.2.0" from vue-router#4.0.14
npm ERR! node_modules/vue-router
npm ERR! vue-router#"*" from the root project
npm ERR!
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 C:\Users\ACER\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ACER\AppData\Local\npm-cache_logs\2022-03-20T12_19_15_072Z-debug-0.log
please help
I solved it by installing vue-router#3.
npm install vue-router#3 --save
You can just try this.
Because your vue is not the latest version, it gives this error.
Use previous versions of vue-router.
To access old versions of vue-router, use the versions tab
Example : npm i vue-router#3.5.3

Error installing and using laravel mix

I want to install Mix in laravel . I run "npm install --no-bin-links" in my IDE terminal or in CMD but I get this error: (my laravel version is 5.4.27)
D:\wamp64\www\laravelProject>npm install --no-bin-links
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--no-bin-links"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! Maximum call stack size exceeded
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! D:\wamp64\www\laravelProject\npm-debug.log
I found!!
I remove node-modules then removed package-lock.json and ran
The following command helped me too:
npm cache clean --force
Also, you might need to add sudo in linux.

Sails.js won't install. Windows

Sails.js will not install, but just to make sure npm is working I installed grunt
npm install -g grunt-cli and it installed correctly.
But when I run npm install -g sails I get an error.
Command prompt error:
`sails#0.11.0 preinstall C:\Users\User\AppData\Roaming\npm\node_modules\sails
node ./lib/preinstall_npmcheck.js
Sails.js Installation - Error
Unable to check your npm-version
Please reinstall npm to use Sails.js
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-
cli.js" "-g" "install" "sails"
npm ERR! node v4.0.0
npm ERR! npm v2.14.2
npm ERR! code ELIFECYCLE
npm ERR! sails#0.11.0 preinstall: node ./lib/preinstall_npmcheck.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sails#0.11.0 preinstall script 'node ./lib/preinstall_npmcheck.js'.
npm ERR! This is most likely a problem with the sails package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./lib/preinstall_npmcheck.js
npm ERR! You can get their info via:
npm ERR! npm owner ls sails
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Windows\system32\npm-debug.log`
npm-debug.log:
https://gist.github.com/anonymous/c850ac8c71e0410db020
I got the same errors.
npm -g install sails
But it worked when I ran command line as administrator.
I solved this by running npm install -g sails --ignore-scripts.
The only thing I can think of is for some reason I don't have ./lib/preinstall_npmcheck.js file and it is trying to run it, so by ignoring it I don't get the error, hence the successful install.
I still don't understand why, but I hope this helps someone.

Mac npm erroring with ENOENT

I'm a recent convert to Mac from Windows, and currently just trying to get my tools setup.
I first installed node using homebrew, which was giving me errors (same as what I still have). I later removed node using homebrew and installed using the pkg from the node website.
I can access node in the command line and npm. The problem is when I try to install modules on the project locally I get something like:
npm install grunt-contrib
Error extracting archive { [Error: ENOENT, open '/Users/davidmckeown/dev/adt-com/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/tmp/phantomjs-1.7.0-macosx.zip']
errno: 34,
code: 'ENOENT',
path: '/Users/davidmckeown/dev/adt-com/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/tmp/phantomjs-1.7.0-macosx.zip' }
Another message just above that contains:
npm ERR! phantomjs#0.2.6 install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 8
npm ERR!
npm ERR! Failed at the phantomjs#0.2.6 install script.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.2.1
npm ERR! command "node" "/usr/local/bin/npm" "install" "grunt-contrib"
npm ERR! cwd /Users/davidmckeown/dev/adt-com
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
Any help figuring out what is causing problems here would be fantastic. This happens with other modules too, from what I can tell.
npm cache clean
or if installed under su
sudo npm cache clean
There was an issue 5 months ago with grunt qunit package - https://github.com/gruntjs/grunt-lib-phantomjs/issues/5.
Try to install this specific package:
sudo npm install grunt-contrib-qunit
The package that you installed is a bundle of many packages. The qunit package version was not updated explicitly to the latest version in this bundle, that's why clearing the npm cache might solve this issue.

Resources