npm run dev not working with webpack/babel conflict - node.js

I am trying to run npm run dev for a Vue project but I keep getting the following output:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: babel-loader#7.1.5
npm ERR! Found: webpack#5.75.0
npm ERR! node_modules/webpack
npm ERR! peer webpack#"^5.0.0" from css-loader#6.7.2
npm ERR! node_modules/css-loader
npm ERR! dev css-loader#"^6.7.2" from the root project
npm ERR! peer webpack#"^5.20.0" from html-webpack-plugin#5.5.0
npm ERR! node_modules/html-webpack-plugin
npm ERR! dev html-webpack-plugin#"^5.5.0" from the root project
npm ERR! 8 more (postcss-loader, terser-webpack-plugin, url-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"2 || 3 || 4" from babel-loader#7.1.5
npm ERR! node_modules/babel-loader
npm ERR! dev babel-loader#"^7.1.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack#4.46.0
npm ERR! node_modules/webpack
npm ERR! peer webpack#"2 || 3 || 4" from babel-loader#7.1.5
npm ERR! node_modules/babel-loader
npm ERR! dev babel-loader#"^7.1.1" 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.
I have no idea what to do, I have tried uninstalling vue-cli and tried re-installing it (I'm not sure if this messed up my packages). Is there a way to cleanly delete everything and start fresh? If anyone can help that would be much appreciated!
Update:
I tried starting a new project with vue init webpack frontend in a new folder and tried installing axios and am getting the following error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: vuex#4.1.0
npm ERR! Found: vue#2.7.14
npm ERR! node_modules/vue
npm ERR! vue#"^2.5.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^3.2.0" from vuex#4.1.0
npm ERR! node_modules/vuex
npm ERR! vuex#"^4.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue#3.2.45
npm ERR! node_modules/vue
npm ERR! peer vue#"^3.2.0" from vuex#4.1.0
npm ERR! node_modules/vuex
npm ERR! vuex#"^4.1.0" 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.
I recently updated my version of node (v19.1.0) and npm (v8.19.3), could that be an issue? It generally seems like I am getting a bunch of conflicts every time I try to install new packages. Is there a way to just start clean?

Probably one of your packages is outdated, according to the error. I guess it's the babel loader.
Method 1 Upgrading or Updating your packages might solve the dependency error.
Method 2 Try running npm install --force or npm install --legacy-peer-deps. It should work.

Related

How can I install the social sharing package in Ionic angular?

Im getting the following error when using the ionic-native/social-sharing package:
Failed to initialize Angular compilation - The target entry-point "#ionic#6421-native/social-sharing" has missing dependencies:
- rxjs/Observable
- rxjs/observable/fromEvent
- rxjs/observable/throw
I have rxjs installed.
Also, when I installed the ionic-native/social-sharing I had to use --force, else it wouldnt install. Not using --force gave the following error:
could not resolve dependency npm err peer rxjs 5.5 11 from ionic-native core 4.20 0
What can I do to solve this? All I want to do is use the #ionic-native/social-sharing package
EDIT:
After deleting node_modules and doing npm i, I get this error when I npm i:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #ionic-native/core#4.20.0
npm ERR! Found: rxjs#7.5.7
npm ERR! node_modules/rxjs
npm ERR! rxjs#"~7.5.0" from the root project
npm ERR! peer rxjs#"^6.5.3 || ^7.4.0" from #angular/common#15.1.4
npm ERR! node_modules/#angular/common
npm ERR! #angular/common#"^15.0.0" from the root project
npm ERR! peer #angular/common#"15.1.4" from #angular/forms#15.1.4
npm ERR! node_modules/#angular/forms
npm ERR! #angular/forms#"^15.0.0" from the root project
npm ERR! 1 more (#ionic/angular)
npm ERR! 3 more (#angular/platform-browser, ...)
npm ERR! 5 more (#angular/core, #angular/forms, #angular/router, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs#"^5.5.11" from #ionic-native/core#4.20.0
npm ERR! node_modules/#ionic-native/core
npm ERR! peer #ionic-native/core#"^4.11.0" from #ionic-native/social-sharing#4.20.0
npm ERR! node_modules/#ionic-native/social-sharing
npm ERR! #ionic-native/social-sharing#"^4.20.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: rxjs#5.5.12
npm ERR! node_modules/rxjs
npm ERR! peer rxjs#"^5.5.11" from #ionic-native/core#4.20.0
npm ERR! node_modules/#ionic-native/core
npm ERR! peer #ionic-native/core#"^4.11.0" from #ionic-native/social-sharing#4.20.0
npm ERR! node_modules/#ionic-native/social-sharing
npm ERR! #ionic-native/social-sharing#"^4.20.0" 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.
Delete the node_modules folder and redo
npm i
then install the component with:
npm i #ionic-native/social-sharing

Conflicting peer dependency: React Native for iOS

When I attempt to build react native program following its official website guideline on Mac, it gives me the following errors. Any suggestions about debugging?
npx react-native init A2 Need to install the following packages:
react-native#0.69.0 Ok to proceed? (y) y npm ERR! code ERESOLVE npm
ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving:
undefined#undefined npm ERR! Found: react-native#0.68.2 npm ERR!
node_modules/react-native npm ERR! peer react-native#"*" from
#react-native-community/cli#7.0.3 npm ERR!
node_modules/#react-native-community/cli npm ERR!
#react-native-community/cli#"^7.0.3" from react-native#0.68.2 npm ERR!
react-native#"0.69.0" from the root project npm ERR! npm ERR! Could
not resolve dependency: npm ERR! react-native#"0.69.0" from the root
project npm ERR! npm ERR! Conflicting peer dependency: react#18.0.0
npm ERR! node_modules/react npm ERR! peer react#"18.0.0" from
react-native#0.69.0 npm ERR! node_modules/react-native npm ERR!
react-native#"0.69.0" 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 ERR! npm ERR! See
/Users/student/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in: npm ERR!
/Users/student/.npm/_logs/2022-06-25T16_09_36_906Z-debug-0.log
This is a problem with peer dependency on the latest node version. This command should solve the problem: npm config set legacy-peer-deps true. Take a look on this issue for reference: https://github.com/facebook/react-native/issues/34051#issuecomment-1198463785

Could not resolve dependency: npm ERR! peer webpack#"^4.0.0" from uglifyjs-webpack-plugin#2.2.0

Here is details of my error:
My node version is 16.13.0 and npm is 8.12.1.
PS D:\ShowCase> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: uglifyjs-webpack-plugin#2.2.0
npm ERR! Found: webpack#5.51.1
npm ERR! node_modules/webpack
npm ERR! dev webpack#"^5.47.1" from the root project
npm ERR! peer webpack#"4.x.x || 5.x.x" from #webpack-cli/configtest#1.0.4
npm ERR! node_modules/#webpack-cli/configtest
npm ERR! #webpack-cli/configtest#"^1.0.4" from webpack-cli#4.8.0
npm ERR! node_modules/webpack-cli
npm ERR! dev webpack-cli#"^4.7.2" from the root project
npm ERR! 3 more (#webpack-cli/configtest, #webpack-cli/info, #webpack-cli/serve)
npm ERR! 8 more (babel-loader, css-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"^4.0.0" from uglifyjs-webpack-plugin#2.2.0
npm ERR! node_modules/uglifyjs-webpack-plugin
npm ERR! dev uglifyjs-webpack-plugin#"^2.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack#4.46.0
npm ERR! node_modules/webpack
npm ERR! peer webpack#"^4.0.0" from uglifyjs-webpack-plugin#2.2.0
npm ERR! node_modules/uglifyjs-webpack-plugin
npm ERR! dev uglifyjs-webpack-plugin#"^2.2.0" 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.
Please let me know if anyone has faced the same problem.
Thanks in advance.
The uglifyjs-webpack-plugin will work fine with Webpack 4 but will not work with Webpack 5. Since this plugin is not scheduled for Webpack 5, You better downgrade Webpack from 5 to 4. Or Try other plugins like babel-minify-webpack-plugin or terser-webpack-plugin to minify javascript if you want to use uglifyjs-webpack-plugin specifically to minimize javascript code.
You can check the last stable release of uglifyjs-webpack-plugin was 3 years ago, and no documented development support for Webpack 5.

Failed to run "npm install" in Vue3 composition api

I want to install dependences in Vue3 project, but I get an error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: vuejs-v-3#0.1.30
npm ERR! Found: vue#3.2.31
npm ERR! node_modules/vue
npm ERR! vue#"^3.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#">= 2.5 < 3" from #vue/composition-api#1.4.9
npm ERR! node_modules/#vue/composition-api
npm ERR! #vue/composition-api#"^1.4.9" 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 ERR!
I try use 'npm i --force' comand, but it donĀ“t work...
should i make a downgrade in node version, or npm, or vue?
thanks

Tried to install React-native-maps and I got this error what does this mean?

Terminal
npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency
tree npm ERR! npm ERR! While resolving: instalawnrn#0.0.1 npm ERR!
Found: react#17.0.1 npm ERR! node_modules/react npm ERR!
react#"17.0.1" from the root project npm ERR! peer react#">= 16.0 ||
< 17.0" from react-native-maps#0.28.0 npm ERR!
node_modules/react-native-maps npm ERR! react-native-maps#"" from
the root project npm ERR! 2 more (react-native, react-native-web)
npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer
react#"17.0.2" from react-dom#17.0.2 npm ERR! node_modules/react-dom
npm ERR! peer react-dom#">=16.5.1" from react-native-web#0.11.7 npm
ERR! node_modules/react-native-web npm ERR! peer
react-native-web#"^0.11" from react-native-maps#0.28.0 npm ERR!
node_modules/react-native-maps npm ERR! react-native-maps#""
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 ERR! npm ERR! See
C:\Users\kcopu\AppData\Local\npm-cache\eresolve-report.txt for a full
report.
The package manager can determine whether or not react-native-maps will be installed. NPM does not work but you can install the package with yarn for example 'yarn add react-native-maps' will work instead of npm Install.
You can do
npm i --legacy-peer-deps
Node packages after this command will be installed perfectly!
I am the same issue.
If I install with this command
npm install react-native-maps --save-exact
not work... but with this command
expo install react-native-maps
works!!

Resources