Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream dependency conflict with Vite 5 when using npm #68

Closed
CookedApps opened this issue Jan 17, 2024 · 4 comments
Closed

Upstream dependency conflict with Vite 5 when using npm #68

CookedApps opened this issue Jan 17, 2024 · 4 comments

Comments

@CookedApps
Copy link

CookedApps commented Jan 17, 2024

Description

When attempting to use vike-react in a project with Vite 5 as a dependency, I am encountering an upstream dependency conflict. This issue occurs specifically when using npm as the package manager. Strangely, the same package.json configuration works without issues when using pnpm, which leads me to believe there might be a compatibility issue with npm.

I am not familiar with pnpm and prefer using npm as it is the default package manager for Node.js. However, due to this issue, I am considering switching to pnpm, though I believe compatibility with npm should be maintained in vike-react.

Steps to Reproduce

  1. Set up a new project with the specified package.json configuration.
  2. Run npm install to install dependencies.
  3. Observe the dependency conflict error.

Expected Behavior

Given that vike-react specifies compatibility with vite@^5.0.10 in its peer dependencies, I would expect npm to resolve these dependencies without any conflicts.

"peerDependencies": {
  "react": "18.x.x",
  "react-dom": "18.x.x",
  "vike": "^0.4.151",
  "vite": "^4.3.8 || ^5.0.10"
},

Actual Behavior

npm throws an upstream dependency conflict error when attempting to install the packages, specifically citing an issue with vike-react and Vite 5. This does not occur with pnpm, suggesting a specific issue with npm's resolution process.

package.json Configuration

{
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@vitejs/plugin-react": "^4.2.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "vike": "^0.4.156",
    "vike-react": "^0.3.8"
  },
  "devDependencies": {
    "@types/react": "^18.2.48",
    "@types/react-dom": "^18.2.18",
    "typescript": "^5.3.3",
    "vite": "^5.0.11"
  }
}

Error Log

# npm resolution error report

While resolving: my-app@0.0.1
Found: vite@5.0.11
node_modules/vite
  dev vite@"^5.0.11" from the root project
  peer vite@">=3.1.0" from vike@0.4.156
  node_modules/vike
    vike@"^0.4.156" from the root project
    peer vike@"^0.4.151" from vike-react@0.3.8
    node_modules/vike-react
      vike-react@"^0.3.8" from the root project

Could not resolve dependency:
peer vite@"^4.3.8" from vike-react@0.3.8
node_modules/vike-react
  vike-react@"^0.3.8" from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Environment

  • Node.js Version: v20.11.0
  • npm Version: 10.30.0
  • Operating System: Linux Mint 21.2
@lourot
Copy link
Contributor

lourot commented Jan 17, 2024

Hey @CookedApps, sorry about that: this is fixed in main but I need to release a new version of vike-react with this dependency ranges fixed. On it

@CookedApps
Copy link
Author

Looking at the actual vike-react npm package, reveals that the logical OR went missing, and it only lists vite@^4.3.8 as peer dependency:

"peerDependencies": {
  "react": "18.x.x",
  "react-dom": "18.x.x",
  "vike": "^0.4.151",
  "vite": "^4.3.8"
},

https://www.npmjs.com/package/vike-react/v/0.3.8?activeTab=code

@CookedApps
Copy link
Author

Hey @CookedApps, sorry about that: this is fixed in main but I need to release a new version of vike-react with this dependency ranges fixed. On it

Alright, thank you!

@lourot
Copy link
Contributor

lourot commented Jan 17, 2024

vike-react@0.3.9 released. Closing as fixed but let me know if it didn't help and I will re-open 🙏

@lourot lourot closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants