blitz-js / blitz

⚡️ The Missing Fullstack Toolkit for Next.js
https://Blitzjs.com
MIT License
13.68k stars 798 forks source link

Error when upgrading to next@13.5.1 #4221

Closed julianklumpers closed 1 year ago

julianklumpers commented 1 year ago

What is the problem?

When upgrading to the latst next@13.5.1 version, blitz dev no longer works. it works on next@13.4.19

Paste all your error logs here:

@dev: Error: Cannot find module 'next/dist/shared/lib/router/utils/resolve-href'
@dev: Require stack:
@dev: - /Users/.../node_modules/@blitzjs/next/dist/index-server.cjs

Paste all relevant code snippets here:

PASTE_HERE (leave the ``` marks)

What are detailed steps to reproduce this?

  1. init a new blitzjs project
  2. upgrade next to version 13.5.1
  3. npm run dev or yarn dev

Run blitz -v and paste the output here:

Blitz version: 2.0.0-beta.33 (local)
macOS Ventura | darwin-arm64 | Node: v19.6.0

 Package manager: npm

  System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M1
    Memory: 46.23 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 19.6.0 - /var/folders/wd/164vtmpd15155cz8k53cmcm80000gn/T/yarn--1695205755763-0.7193118005894912/node
    Yarn: 1.22.19 - /var/folders/wd/164vtmpd15155cz8k53cmcm80000gn/T/yarn--1695205755763-0.7193118005894912/yarn
    npm: 9.4.0 - /opt/homebrew/bin/npm
  npmPackages:
    @blitzjs/auth: 2.0.0-beta.33 => 2.0.0-beta.33 
    @blitzjs/next: 2.0.0-beta.33 => 2.0.0-beta.33 
    @blitzjs/rpc: 2.0.0-beta.33 => 2.0.0-beta.33 
    @prisma/client: Not Found
    blitz: 2.0.0-beta.33 => 2.0.0-beta.33 
    next: 13.5.1 => 13.5.1 
    prisma: Not Found
    react: ^18.2.0 => 18.2.0 
    react-dom: ^18.2.0 => 18.2.0 
    typescript: ^5.2.2 => 5.2.2 

Please include below any other applicable logs and screenshots that show your problem:

No response

siddhsuresh commented 1 year ago

@julianklumpers , thanks for the issue. Will get this fixed quickly.

kitze commented 1 year ago

tnx @siddhsuresh . For now I'm patching the index-server.cjs file to use const resolveHref = require('next/dist/client/resolve-href');

kitze commented 1 year ago

thank you so much @siddhsuresh !

msert29 commented 1 year ago

@kitze just got stuck with the same error following your zero-to-shipped course 🤣

I resolved it upgrading next to 13.5.2

jorisck commented 9 months ago

@kitze just got stuck with the same error following your zero-to-shipped course 🤣

I resolved it upgrading next to 13.5.2

Could you share your package json ? I stuck with the same error for the same course. I don't understnd why

msert29 commented 8 months ago
{
  "name": "project",
  "version": "1.0.0",
  "scripts": {
    "dev": "blitz dev",
    "build": "blitz build",
    "start": "blitz start",
    "studio": "blitz prisma studio",
    "lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .",
    "test": "vitest run --passWithNoTests",
    "test:watch": "vitest",
    "prepare": "husky install"
  },
  "prisma": {
    "schema": "db/schema.prisma"
  },
  "prettier": {
    "semi": false,
    "printWidth": 100
  },
  "lint-staged": {
    "*.{js,ts,tsx}": [
      "eslint --fix"
    ]
  },
  "dependencies": {
    "@blitzjs/auth": "2.0.5",
    "@blitzjs/next": "2.0.5",
    "@blitzjs/rpc": "2.0.5",
    "@prisma/client": "4.6.1",
    "blitz": "2.0.5",
    "next": "13.5.2",
    "prisma": "4.6.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "secure-password": "4.0.0",
    "zod": "3.22.4",
    "formik": "2.4.5"
  },
  "devDependencies": {
    "@next/bundle-analyzer": "12.0.8",
    "@next/env": "13.4.19",
    "@testing-library/jest-dom": "5.16.5",
    "@testing-library/react": "13.4.0",
    "@testing-library/react-hooks": "8.0.1",
    "@types/node": "18.11.9",
    "@types/preview-email": "2.0.1",
    "@types/react": "18.0.25",
    "@typescript-eslint/eslint-plugin": "5.42.1",
    "@vitejs/plugin-react": "2.2.0",
    "eslint": "8.27.0",
    "eslint-config-next": "12.3.1",
    "eslint-config-prettier": "8.5.0",
    "husky": "8.0.2",
    "jsdom": "20.0.3",
    "lint-staged": "13.0.3",
    "prettier": "^2.7.1",
    "prettier-plugin-prisma": "4.4.0",
    "pretty-quick": "3.1.3",
    "preview-email": "3.0.7",
    "typescript": "^4.8.4",
    "vite-tsconfig-paths": "3.6.0",
    "vitest": "0.25.3"
  },
  "private": true
}