feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.97k stars 744 forks source link

Could not resolve dependency: npm ERR! peer mongodb@"^5.2.0" from @feathersjs/mongodb@5.0.9 #3286

Closed MarcGodard closed 9 months ago

MarcGodard commented 9 months ago

Steps to reproduce

Using node version: v18.18.0

Create a new project with the following values:

marcgodard@pop-os:~/Documents/Github$ npm create feathers@latest feathers-chat
Need to install the following packages:
create-feathers@5.0.9
Ok to proceed? (y) 
? Do you want to use JavaScript or TypeScript? JavaScript
? Write a short description 
? Which HTTP framework do you want to use? KoaJS (recommended)
? What APIs do you want to offer? HTTP (REST), Real-time
? Which package manager are you using? npm
? Generate client? Can be used with React, Angular, Vue, React Native, Node.js etc. No
? What is your preferred schema (model) definition format? Schemas allow to type, validate, secure and populate your data and configuration JSON schema
? Which database are you connecting to? Databases can be added at any time MongoDB
? Enter your database connection string mongodb://127.0.0.1:27017/feathers-chat
    Wrote file test/app.test.js
    Wrote file src/app.js
    Wrote file src/channels.js
    Wrote file config/default.json
    Wrote file config/test.json
    Wrote file config/custom-environment-variables.json
    Wrote file src/configuration.js
    Wrote file public/index.html
    Wrote file src/index.js
    Wrote file src/logger.js
    Wrote file src/hooks/log-error.js
    Wrote file package.json
    Wrote file .prettierrc
    Wrote file readme.md
    Wrote file src/services/index.js
    Wrote file src/validators.js
    Wrote file src/mongodb.js
    Updated src/app.js
    Updated src/validators.js
    Running npm install --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: feathers-chat@0.0.0
npm ERR! Found: mongodb@6.1.0
npm ERR! node_modules/mongodb
npm ERR!   mongodb@"^6.1.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer mongodb@"^5.2.0" from @feathersjs/mongodb@5.0.9
npm ERR! node_modules/@feathersjs/mongodb
npm ERR!   @feathersjs/mongodb@"^5.0.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! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /home/marcgodard/.npm/_logs/2023-09-30T15_14_16_178Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /home/marcgodard/.npm/_logs/2023-09-30T15_14_16_178Z-debug-0.log
Error: undefined

Hooray! Your Feathers app is ready to go! 🚀
Go to the feathers-chat folder to get started.

To learn more visit https://feathersjs.com/guides

When adding it to another project.

marcgodard@pop-os:~/Documents/Github/swp-api$ npm i mongodb
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: swp-api@0.0.0
npm WARN Found: mongodb@5.9.0
npm WARN node_modules/mongodb
npm WARN   peer mongodb@"^5.2.0" from @feathersjs/mongodb@5.0.9
npm WARN   node_modules/@feathersjs/mongodb
npm WARN     @feathersjs/mongodb@"^5.0.9" from the root project
npm WARN   1 more (the root project)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer mongodb@"^5.2.0" from @feathersjs/mongodb@5.0.9
npm WARN node_modules/@feathersjs/mongodb
npm WARN   @feathersjs/mongodb@"^5.0.9" from the root project

changed 2 packages, and audited 703 packages in 2s
minirobotdan commented 9 months ago

Same here. Tried installing @5.0.8 as well, same issue.

suleimanas commented 9 months ago

same here @5.0.9

minirobotdan commented 9 months ago

If it helps, it's absolutely not a solve but if you're just trying to get a project stood up to do some exploratory work (my case right now), you can grab the full npm install instruction from the NPM logs (as the package.json is empty to begin with). In my case, the command was:

npm install @feathersjs/mongodb@^5.0.9 mongodb@^6.1.0 @feathersjs/feathers@^5.0.9 @feathersjs/errors@^5.0.9 @feathersjs/schema@^5.0.9 @feathersjs/configuration@^5.0.9 @feathersjs/transport-commons@^5.0.9 @feathersjs/adapter-commons@^5.0.9 @feathersjs/authentication@^5.0.9 @feathersjs/authentication-client@^5.0.9 winston@latest @feathersjs/socketio@^5.0.9 @feathersjs/koa@^5.0.9 @feathersjs/typebox@^5.0.9

Then you can add --legacy-peer-deps or --force, pick your poison.

daffl commented 9 months ago

Fixed in v5.0.10