romi / plant-3d-explorer

Browser application to visualize 3D scanned plants
https://romi.github.io/plant-3d-explorer/
GNU Affero General Public License v3.0
7 stars 6 forks source link

npm install error (dependancy react-router) #118

Closed fabfabBesnard closed 3 years ago

fabfabBesnard commented 3 years ago

after last merge (commit cd01f1d), I get the following error after npm install

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: react-router@4.4.0-beta.8
npm ERR! node_modules/react-router
npm ERR!   react-router@"^4.4.0-beta.7" from the root project
npm ERR!   react-router@"^4.4.0-beta.8" from react-router-dom@4.4.0-beta.8
npm ERR!   node_modules/react-router-dom
npm ERR!     react-router-dom@"^4.4.0-beta.7" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-router@"^5.0.0" from use-react-router@1.0.7
npm ERR! node_modules/use-react-router
npm ERR!   use-react-router@"^1.0.3" 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 /home/fabfab/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fabfab/.npm/_logs/2021-06-08T15_21_53_261Z-debug.log
fabfabBesnard commented 3 years ago

Note: this issue might be linked to recent automatic upgrade of three and axios (see PR#99 and PR#100)

Please follow the temporary hack: use npm install --force

The prompt indicate the same error message, but it is turned into a WARN that will be skipped:

npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react-router@4.4.0-beta.8
npm WARN node_modules/react-router
npm WARN   react-router@"^4.4.0-beta.7" from the root project
npm WARN   1 more (react-router-dom)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react-router@"^5.0.0" from use-react-router@1.0.7
npm WARN node_modules/use-react-router
npm WARN   use-react-router@"^1.0.3" from the root project

Installation proceeds, but and yields the following result:

added 4347 packages, and audited 4349 packages in 1m

264 packages are looking for funding
  run `npm fund` for details

90 vulnerabilities (25 low, 27 moderate, 38 high)

To start the app, you must modified the .envfile in the repo by adding: SKIP_PREFLIGHT_CHECK=true

If you do note add this option, npm start command will fail and the following error/debug message (indicatong the aforementioned hack at the end of the message) should appear:

> sony_visualiseur-plantes-3d@0.1.0 start
> NODE_ENV=development react-scripts start

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The react-scripts package provided by Create React App requires a dependency:

  "babel-eslint": "9.0.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-eslint was detected higher up in the tree:

  /home/fabfab/softwares/romi/plant-3d-explorer/node_modules/babel-eslint (version: 10.1.0) 

Manually installing incompatible versions is known to cause hard-to-debug issues.

If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.

To fix the dependency tree, try following the steps below in the exact order:

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
  2. Delete node_modules in your project folder.
  3. Remove "babel-eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:

  5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
     This may help because npm has known issues with package hoisting which may get resolved in future versions.

  6. Check if /home/fabfab/softwares/romi/plant-3d-explorer/node_modules/babel-eslint is outside your project directory.
     For example, you might have accidentally installed something in your home folder.

  7. Try running npm ls babel-eslint in your project folder.
     This will tell you which other package (apart from the expected react-scripts) installed babel-eslint.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.

P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
fabfabBesnard commented 3 years ago

npm ls babel-eslint gives:


sony_visualiseur-plantes-3d@0.1.0 /home/fabfab/softwares/romi/plant-3d-explorer
├─┬ gatsby-plugin-react-svg@3.0.1
│ └─┬ gatsby@3.6.2
│   └─┬ eslint-config-react-app@6.0.0
│     └── babel-eslint@10.1.0
└─┬ react-scripts@2.1.5
  ├── babel-eslint@9.0.0
  └─┬ eslint-config-react-app@3.0.8
    └── babel-eslint@9.0.0 deduped

so the versions of "babel-eslint" required for react-scripts and gatsby-plugin-react-svg are conflicting

gregho67 commented 3 years ago

The npm install errors should be fixed with this pull request : #124 . The error with npm start is not yet fixed so it's something that still needs to be taken care of.