Skip to content

Cannot add a module in pnpm root workspaces #1013

@cjpearson

Description

@cjpearson

When the Nuxt application is the root of a pnpm workspace, the module add command fails.

❯ pnpm dlx nuxt module add @nuxtjs/tailwindcss
ℹ Resolved @nuxtjs/tailwindcss, adding module...                                                                                                               nuxi 11:39:44 AM
ℹ Installing @nuxtjs/tailwindcss@6.14.0 as a dependency                                                                                                        nuxi 11:39:44 AM
 ERR_PNPM_ADDING_TO_ROOT  Running this command will add the dependency to the workspace root, which might not be what you want - if you really meant it, make it explicit by running this command again with the -w flag (or --workspace-root). If you don't want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.

 ERROR  corepack pnpm add @nuxtjs/tailwindcss@6.14.0 failed.

The addDependency function from nypm does support a workspace: true option, but in that case it would fail if run outside of a workspace root. I don't know if this is a common case, but maybe it would be possible to detect if it's run in a workspace root and set the option accordingly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions