How to upgrade a Nuxt v3 project to the latest Nuxt 3 version?

I tried npx nuxt upgrade --dedupe but it upgraded my project to v4. I want to upgrade to the latest v3
2 Replies
kapa.ai
kapa.ai5w ago
Hi @lazygopher. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To upgrade your Nuxt v3 project to the latest Nuxt 3 version (and not Nuxt 4), you should avoid using the default upgrade command, as it will upgrade to the latest major version (currently v4). Instead, you need to explicitly specify the latest v3 version in your package.json. Here’s how you can do it: 1. Update your package.json
Change your Nuxt dependency to the latest v3 version, for example:
{
"devDependencies": {
"nuxt": "^3.17.7"
}
}

{
"devDependencies": {
"nuxt": "^3.17.7"
}
}

(Replace ^3.17.7 with the latest v3.x version you want. You can check the Nuxt releases for the most recent v3 version.) 2. Remove your lockfile and node_modules
Delete package-lock.json, yarn.lock, or pnpm-lock.yaml and the node_modules directory. 3. Reinstall dependencies
Run your package manager’s install command:
npm install
# or
yarn install
# or
pnpm install

npm install
# or
yarn install
# or
pnpm install

Alternatively, you can use the nightly release channel for v3 by setting:
{
"devDependencies": {
"nuxt": "npm:nuxt-nightly@3x"
}
}
{
"devDependencies": {
"nuxt": "npm:nuxt-nightly@3x"
}
}
Then remove your lockfile and reinstall dependencies as above. This will keep you on the latest v3 nightly build, not v4 see docs. Note:
The npx nuxt upgrade or npx nuxt upgrade --dedupe command will upgrade to the latest major version (v4), so it’s not suitable if you want to stay on v3 see docs. If you want to upgrade to the latest v3 patch version, you can also run:
npx nuxi@latest upgrade --dedupe
npx nuxi@latest upgrade --dedupe
But make sure your package.json is pinned to a v3 version, not a caret (^) or wildcard that would allow v4 see v3.17.4 release notes. Summary:
- Pin Nuxt to the latest v3 version in your package.json - Remove lockfile and node_modules - Reinstall dependencies This will ensure you stay on Nuxt 3 and do not upgrade to Nuxt 4. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5w ago
<@693201794137981049> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?