Skip to content

fix: devtools package is importing from undeclared dependency unstorage #942

@loilo

Description

@loilo

🐛 The bug

The following has been reported when reinstalling my dependencies in Nuxt today, as part of the nuxt prepare command:

Screenshot of a CLI error stating that "cannot find package 'unstorage' imported from […] /@nuxt/devtools/dist/chunks/module-main.mjs"

From what I can tell, this problem has been introduced in 902c60c, when functions from unstorage were first imported without declaring it a dependency.

🛠️ To reproduce

🌈 Expected behavior

The error should never happen because in every case, either unstorage would be installed directly inside node_modules (probably the case for 99% of users) or inside node_modules/@nuxt/devtools/node_modules (cannot happen because of missing dependency).

ℹ️ Additional context

Unfortunately, I am not able to provide a clean minimal reproduction since in all fresh Nuxt projects I'm setting up, unstorage is always deduped, so it ends up in node_modules as a dependency of a different package (e.g. @nuxt/nitro-server, which is probably why this has not happened to anyone else yet):

Screenshot of the output of "npm ls unstorage" with unstorage being installed as a subdependency, but deduped

My own dependency tree looks like this, with unstorage not being deduped (for reasons unknown to me), and therefore not ending up directly inside node_modules at all:

Screenshot of the output of "npm ls unstorage" with unstorage being installed as a subdependency without being deduped

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions