Skip to content

Some packages can't find their dependencies, if modules-dir option is customized #3604

Closed

Description

@flosker

pnpm version: 6.9.1

Code to reproduce the issue:

  1. In .npmrc, set modules-dir path to something like 'vendor' (instead of node_modules).
  2. Download demo repo. Has boilerplate config files. Sorry for not uploading a repo, having issues with git.
  3. Do pnpm install.
  4. Run pnpm vendors/.bin/snowpack dev.

Actual behavior:

Because modules-dir option is customized, package snowpack can't find its plugin 'postcss'.

Expected behavior:

Snowpack should be able to find other installed packages and start the dev server.

How to fix

Also add modules-dir's absolute path to NODE_PATH env variable. In bash script of package ([modules-dir]/.bin/package).

Additional information:

  • node -v prints: 16.4.0
  • Windows, macOS, or Linux?: Linux (Fedora 34)

Activity

  1. flosker commented on Aug 6, 2021

    @flosker
    Author

    @zkochan Any progress?

  2. zkochan commented on Aug 6, 2021

    @zkochan
    Member

    Why do you need custom module directory? If snowpack doesn't find it, probably it doesn't work with custom module directory names.

  3. flosker commented on Aug 6, 2021

    @flosker
    Author

    When I manually added modules-dir path to NODE_PATH variable, Snowpack did find it's postcss plugin.

    So adding that path does fixes the package missing issues.

    Custom modules-dir path gives more control over project's organization structure.

  4. flosker commented on Aug 6, 2021

    @flosker
    Author

    Off topic: Latest Snowpack doesn't work at all when installed with pnpm. With vanilla config.

    1. Create new folder
    2. pnpm add --save-dev [email protected] (latest)
    3. pnpm snowpack dev

    Snowpack complains about missing dependencies, even after shamefully hoisting. First I thought it was Snowpack's fault, but it works fine with npm & yarn.

    FredKSchott/snowpack#3594

  5. flosker commented on Aug 21, 2021

    @flosker
    Author

    @zkochan A path in NODE_PATH also helps ESlint plugin system.

    So I really think prefixing modules-dir path to NODE_PATH variable will help a lot, and will also complement the modules-dir option, as it exists to customize node_modules folder.

    Without it module-dir option is kind of incomplete.

  6. 3 remaining items

  7. added a commit that references this issue on Sep 22, 2026
    88fede4
  8. added a commit that references this issue on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions