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 v32 Replies
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: (Replace
Delete
Run your package manager’s install command: Alternatively, you can use the nightly release channel for v3 by setting: 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
- Pin Nuxt to the latest v3 version in your
Change your Nuxt dependency to the latest v3 version, for example: (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_modulesDelete
package-lock.json
, yarn.lock
, or pnpm-lock.yaml
and the node_modules
directory.
3. Reinstall dependenciesRun your package manager’s install command: Alternatively, you can use the nightly release channel for v3 by setting: 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:
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:
----------------------<@693201794137981049> Kapa.ai is still learning and improving, please let me know how I did by reacting below.