How to upgrade from Strapi v4.15.0 to v.4.23.0?

System Information
  • Strapi Version: 4.15.0
  • Operating System: MacOS Sonoma 14.4.1
  • Database:
  • Node Version: v18.20.2
  • ~NPM Version: ~
  • Yarn Version: 4.1.1 / 1.22.22

Hi! I’m having trouble upgrading Strapi from v4.15.0 to v.4.23.0. The first two code snippet below shows the specific package upgrades I am trying to make in the dependencies in the package.json file. I have attempted to upgrade to other versions below 4.23.0, but they all fail on the @strapi/strapi admin package when running yarn build. How do I fix this? The error message is always related to a package.json file within the node modules. I cannot possibly go ahead and change this manually, as it would be overwritten each time yarn is run?

Upgrading from

"@strapi/plugin-graphql": "4.15.0",
    "@strapi/plugin-i18n": "4.15.0",
    "@strapi/plugin-sentry": "4.15.0",
    "@strapi/plugin-users-permissions": "4.15.0",
    "@strapi/strapi": "4.15.0",
    "better-sqlite3": "8.0.1",

Upgrading to:

    "@strapi/plugin-graphql": "4.23.0",
    "@strapi/plugin-i18n": "4.23.0",
    "@strapi/plugin-sentry": "4.23.0",
    "@strapi/plugin-users-permissions": "4.23.0",
    "@strapi/strapi": "4.23.0",
    "better-sqlite3": "9.5.0",

The error message output:

Here is the file node_modules/@strapi/admin/package.json

{
  "name": "@strapi/admin",
  "version": "4.23.0",
  "description": "Strapi Admin",
  "repository": {
    "type": "git",
    "url": "git://github.com/strapi/strapi.git"
  },
  "license": "SEE LICENSE IN LICENSE",
  "author": {
    "name": "Strapi Solutions SAS",
    "email": "hi@strapi.io",
    "url": "https://strapi.io"
  },
  "maintainers": [
    {
      "name": "Strapi Solutions SAS",
      "email": "hi@strapi.io",
      "url": "https://strapi.io"
    }
  ],
  "exports": {
    ".": {
      "types": "./index.d.ts",
      "source": "./index.js",
      "require": "./index.js",
      "default": "./index.js"
    },
    "./strapi-admin": {
      "types": "./dist/admin/src/index.d.ts",
      "source": "./admin/src/index.ts",
      "import": "./dist/admin/index.mjs",
      "require": "./dist/admin/index.js",
      "default": "./dist/admin/index.js"
    },
    "./strapi-server": {
      "types": "./dist/server/src/index.d.ts",
      "source": "./server/src/index.js",
      "require": "./strapi-server.js",
      "default": "./strapi-server.js"
    },
    "./cli": {
      "source": "./_internal/index.ts",
      "import": "./dist/cli.mjs",
      "require": "./dist/cli.js",
      "default": "./dist/cli.js"
    },
    "./package.json": "./package.json"
  },
  "files": [
    "./dist",
    "strapi-server.js",
    "index.js",
    "index.d.ts"
  ],
  "scripts": {
    "build": "pack-up build",
    "clean": "run -T rimraf ./dist",
    "lint": "run -T eslint .",
    "test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
    "test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
    "test:ts": "run -T tsc -p tsconfig.json",
    "test:ts:back": "run -T tsc --noEmit -p server/tsconfig.json",
    "test:ts:front": "run -T tsc -p admin/tsconfig.json && run -T tsc -p ee/admin/tsconfig.json",
    "test:unit": "run -T jest",
    "test:unit:watch": "run -T jest --watch",
    "watch": "pack-up watch"
  },
  "dependencies": {
    "@casl/ability": "6.5.0",
    "@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
    "@radix-ui/react-context": "1.0.1",
    "@radix-ui/react-toolbar": "1.0.4",
    "@reduxjs/toolkit": "1.9.7",
    "@strapi/design-system": "1.16.0",
    "@strapi/helper-plugin": "4.23.0",
    "@strapi/icons": "1.16.0",
    "@strapi/permissions": "4.23.0",
    "@strapi/provider-audit-logs-local": "4.23.0",
    "@strapi/types": "4.23.0",
    "@strapi/typescript-utils": "4.23.0",
    "@strapi/utils": "4.23.0",
    "@vitejs/plugin-react-swc": "3.5.0",
    "axios": "1.6.0",
    "bcryptjs": "2.4.3",
    "boxen": "5.1.2",
    "browserslist": "^4.22.2",
    "browserslist-to-esbuild": "1.2.0",
    "chalk": "^4.1.2",
    "chokidar": "3.5.3",
    "codemirror5": "npm:codemirror@^5.65.11",
    "cross-env": "^7.0.3",
    "css-loader": "^6.9.0",
    "date-fns": "2.30.0",
    "dotenv": "14.2.0",
    "esbuild": "0.19.11",
    "esbuild-loader": "^2.21.0",
    "esbuild-register": "3.5.0",
    "execa": "5.1.1",
    "fast-deep-equal": "3.1.3",
    "find-root": "1.1.0",
    "fork-ts-checker-webpack-plugin": "9.0.2",
    "formik": "2.4.0",
    "fractional-indexing": "3.2.0",
    "fs-extra": "10.0.0",
    "highlight.js": "^10.4.1",
    "history": "^4.9.0",
    "html-webpack-plugin": "5.6.0",
    "immer": "9.0.19",
    "inquirer": "8.2.5",
    "invariant": "^2.2.4",
    "js-cookie": "2.2.1",
    "jsonwebtoken": "9.0.0",
    "koa": "2.13.4",
    "koa-bodyparser": "4.4.1",
    "koa-compose": "4.1.0",
    "koa-passport": "5.0.0",
    "koa-static": "5.0.0",
    "koa2-ratelimit": "^1.1.2",
    "lodash": "4.17.21",
    "markdown-it": "^12.3.2",
    "markdown-it-abbr": "^1.0.4",
    "markdown-it-container": "^3.0.0",
    "markdown-it-deflist": "^2.1.0",
    "markdown-it-emoji": "^2.0.0",
    "markdown-it-footnote": "^3.0.3",
    "markdown-it-ins": "^3.0.1",
    "markdown-it-mark": "^3.0.1",
    "markdown-it-sub": "^1.0.0",
    "markdown-it-sup": "1.0.0",
    "mini-css-extract-plugin": "2.7.7",
    "node-schedule": "2.1.0",
    "ora": "5.4.1",
    "outdent": "0.8.0",
    "p-map": "4.0.0",
    "passport-local": "1.0.0",
    "pluralize": "8.0.0",
    "prettier": "2.8.4",
    "prop-types": "^15.8.1",
    "qs": "6.11.1",
    "react-dnd": "16.0.1",
    "react-dnd-html5-backend": "16.0.1",
    "react-error-boundary": "3.1.4",
    "react-helmet": "^6.1.0",
    "react-intl": "6.4.1",
    "react-is": "^18.2.0",
    "react-query": "3.39.3",
    "react-redux": "8.1.1",
    "react-refresh": "0.14.0",
    "react-select": "5.7.0",
    "react-window": "1.8.8",
    "read-pkg-up": "7.0.1",
    "resolve-from": "5.0.0",
    "rimraf": "3.0.2",
    "sanitize-html": "2.13.0",
    "semver": "7.5.4",
    "sift": "16.0.1",
    "slate": "0.94.1",
    "slate-history": "0.93.0",
    "slate-react": "0.98.3",
    "style-loader": "3.3.4",
    "typescript": "5.2.2",
    "use-context-selector": "1.4.1",
    "vite": "5.0.13",
    "webpack": "^5.89.0",
    "webpack-bundle-analyzer": "^4.10.1",
    "webpack-dev-middleware": "6.1.2",
    "webpack-hot-middleware": "2.26.0",
    "yup": "0.32.9"
  },
  "devDependencies": {
    "@strapi/admin-test-utils": "4.23.0",
    "@strapi/data-transfer": "4.23.0",
    "@strapi/pack-up": "4.23.0",
    "@strapi/plugin-content-manager": "4.23.0",
    "@strapi/strapi": "4.23.0",
    "@testing-library/dom": "9.2.0",
    "@testing-library/react": "14.0.0",
    "@testing-library/user-event": "14.4.3",
    "@types/codemirror5": "npm:@types/codemirror@^5.60.15",
    "@types/find-root": "1.1.3",
    "@types/invariant": "2.2.36",
    "@types/jest": "29.5.2",
    "@types/js-cookie": "3.0.5",
    "@types/jsonwebtoken": "9.0.3",
    "@types/koa-passport": "6.0.1",
    "@types/lodash": "^4.14.191",
    "@types/markdown-it": "13.0.7",
    "@types/markdown-it-container": "2.0.9",
    "@types/markdown-it-emoji": "2.0.4",
    "@types/markdown-it-footnote": "3.0.3",
    "@types/passport-local": "1.0.36",
    "@types/pluralize": "0.0.32",
    "@types/react-window": "1.8.8",
    "@types/sanitize-html": "2.11.0",
    "@types/webpack-bundle-analyzer": "4.6.3",
    "@types/webpack-hot-middleware": "2.25.9",
    "msw": "1.3.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "5.3.4",
    "styled-components": "5.3.3"
  },
  "peerDependencies": {
    "@strapi/data-transfer": "^4.16.0",
    "@strapi/strapi": "^4.3.4",
    "react": "^17.0.0 || ^18.0.0",
    "react-dom": "^17.0.0 || ^18.0.0",
    "react-router-dom": "^5.2.0",
    "styled-components": "^5.2.1"
  },
  "engines": {
    "node": ">=18.0.0 <=20.x.x",
    "npm": ">=6.0.0"
  },
  "nx": {
    "targets": {
      "build": {
        "outputs": [
          "{projectRoot}/build"
        ]
      }
    }
  },
  "gitHead": "some git commit id here"
}

Hi, you can see this post maybe could be useful

1 Like

I’m updating like you from 4.15.5 to 4.23.0 and having this database error:

"up_permissions_role_links" add constraint "up_permissions_role_links_fk" foreign key ("permission_id") references "up_permissions" ("id") on delete CASCADE - there is no unique constraint matching given keys for referenced table "up_permissions"

i did a migration to modify the up_permissions table but it didn’t work. Does anyone know how to fix it?

The issue was related to the use of a strapi plugin with placeholders for images. Manged to upgrade Strapi after migrating the data related to the placeholder.