How to upgrade nuxt in a monorepo
I have a monorepo with one package-lock.json in the root and a frontend folder where nuxt lives. I want wo use the npx nuxt upgrade frontend --dedupe command but that does not find the package-lock.
ddev npx nuxt upgrade frontend --dedupe
ℹ Package manager: npm 10.8.2 nuxi 10:02:33 AM
ℹ Current Nuxt version: 4.1.1 nuxi 10:02:33 AM
ERROR Unable to find any lock files in /var/www/html/frontend nuxi 10:02:33 AM
ℹ Installing latest stable Nuxt 4 release... nuxi 10:02:33 AM
npm error code ERR_INVALID_ARG_TYPE
npm error The "from" argument must be of type string. Received undefined
npm error A complete log of this run can be found in: /mnt/ddev-global-cache/npm/_logs/2025-09-23T08_02_33_601Z-debug-0.log
5 Replies
Hi @Samuelreichoer. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
When upgrading Nuxt in a monorepo where your Nuxt project is in a subfolder (e.g., frontend) but your lockfile (e.g., package-lock.json) is in the root, the nuxt upgrade command expects the lockfile to be in the same directory as your Nuxt project. If it doesn't find a lockfile in the frontend directory, you'll get the "Unable to find any lock files" error, as you've experienced.
The knowledge sources do not provide a built-in way for nuxt upgrade to reference a lockfile outside the Nuxt project directory. The command looks for lockfiles in the specified working directory, and there is no documented option to point it to a different location for the lockfile. The --cwd option changes the working directory, but if your lockfile is not in the same directory as your Nuxt project, this won't resolve the issue.
Workarounds based on the documentation:
- You can try running the upgrade command from the root of your monorepo (where the lockfile is), and use the --cwd option to specify the Nuxt project directory:
This way, the command runs in the root (where the lockfile is), but operates on the Nuxt project in the frontend directory. This approach is supported by the documented options for the upgrade command, where --cwd takes precedence over the positional ROOTDIR argument and specifies the working directory for the command, which should help it find the lockfile and upgrade Nuxt in the correct subproject nuxt upgrade command docs.
If this does not work, you may need to temporarily copy the lockfile into the frontend directory, run the upgrade, and then move it back, but this is not an officially documented workflow.
Summary:
The nuxt upgrade command requires the lockfile to be in the working directory. Use the --cwd option to point to the root where your lockfile is, while targeting the Nuxt project in your subfolder. If this does not work, the knowledge sources do not provide an official solution for monorepo setups with a single root lockfile and Nuxt in a subfolder. If you need more advanced monorepo support, you may need to manage upgrades manually or look for future improvements in Nuxt's CLI tooling nuxt upgrade command docs. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
The nuxt upgrade command requires the lockfile to be in the working directory. Use the --cwd option to point to the root where your lockfile is, while targeting the Nuxt project in your subfolder. If this does not work, the knowledge sources do not provide an official solution for monorepo setups with a single root lockfile and Nuxt in a subfolder. If you need more advanced monorepo support, you may need to manage upgrades manually or look for future improvements in Nuxt's CLI tooling nuxt upgrade command docs. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@1065266379382587422> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Then I get
sh: 1: nuxi: not found
@kapa.ai then i get
sh: 1: nuxi: not found
Let me check the knowledge base for you again. One moment! :books:
----------------------
The error
sh: 1: nuxi: not found means that the nuxi CLI is not available in your current environment or not installed in the context where the command is being run.
Based on the official Nuxt documentation, you need to have nuxi installed as a development dependency in your project to use commands like nuxt upgrade. In a monorepo, you should install nuxi in the root where your package-lock.json is located:
or, if you use yarn:
After installing, try running your upgrade command again from the root:
This should resolve the "nuxi: not found" error, as nuxi will be available for npx to execute Nuxt Bridge Nitro docs.
If you continue to have issues, ensure your package manager's bin directory is in your PATH, or use npx as shown above to invoke nuxi directly.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1065266379382587422> Kapa.ai is still learning and improving, please let me know how I did by reacting below.