strapi / nextjs-corporate-starter

Strapi Demo application for Corporate Websites using Next.js
MIT License
966 stars 287 forks source link

How can I upgrade my Strapi version to v4.10.5? #17

Closed code-savior closed 1 year ago

code-savior commented 1 year ago

When I directly modify the version in package.json and run npm install again, it throws an error.

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: corporate-blog-template@0.1.0 npm ERR! Found: @strapi/strapi@undefined npm ERR! node_modules/@strapi/strapi npm ERR! @strapi/strapi@"4.10.5" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @strapi/strapi@"^4.0.0" from @strapi/plugin-seo@1.8.0 npm ERR! node_modules/@strapi/plugin-seo npm ERR! @strapi/plugin-seo@"^1.8.0" 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.

PaulBratslavsky commented 1 year ago

@code-savior

I was able to upgrade no issue. Which node version were you using.

I am using v18.14.2 here is a video of my upgrade steps.

https://github.com/strapi/nextjs-corporate-starter/assets/6153188/1bb586be-c498-484d-96ec-ec42e303fafb

Updating Your Strapi Project

Navigate to your backend/package.json file.

 "dependencies": {
    "@strapi/plugin-i18n": "4.9.2",
    "@strapi/plugin-seo": "^1.8.0",
    "@strapi/plugin-users-permissions": "4.9.2",
    "@strapi/strapi": "4.9.2",
    "better-sqlite3": "7.4.6"
  },

You can see my current project dependencies. I am going to replace my Strapi version from 4.9.2 to 4.10.5

 "dependencies": {
    "@strapi/plugin-i18n": "4.10.5",
    "@strapi/plugin-seo": "^1.8.0",
    "@strapi/plugin-users-permissions": "4.10.5",
    "@strapi/strapi": "4.10.5",
    "better-sqlite3": "7.4.6"
  },

note: if you are using additional external packages or plugins, check and update accordingly.

Once you make the changes in your package.json file run the following commands for clean update.

Make sure you are in the correct folder. I am in the backend folder of my project. This is where you will find your Strapi code.

rm -rf node_modules
rm yarn.lock
yarn
yarn build && yarn develop

Once you check that everything is running correctly push all your recent changes to github.

PaulBratslavsky commented 1 year ago

@code-savior I hope this helped, I will be closing this issue, but if you have any additional questions let me know.