Skip to content

Issues with PNPM module resolution #1986

Open
@geiszla

Description

@geiszla

We are using PNPM as a package manager and recently the ESLint VSCode extension stopped working in our repo with the following messages:

[Info - 6:16:51 PM] ESLint server is starting.
[Info - 6:16:51 PM] ESLint server running in node v22.14.0
[Info - 6:16:51 PM] ESLint server is running.
[Info - 6:16:52 PM] Server process exited successfully
[Info - 6:16:53 PM] ESLint library loaded from: C:\shopify\loyalty-program-shopify\node_modules.pnpm\eslint@8.57.1\node_modules\eslint\lib\api.js
[Error - 6:16:55 PM]
Failed to load plugin 'react-hooks' declared in '.eslintrc.json » eslint-config-airbnb/hooks » C:\shopify\loyalty-program-shopify\node_modules.pnpm\eslint-config-airbnb@19.0.4_92edc6589d0da743fbf0632d9f1d5a8d\node_modules\eslint-config-airbnb\rules\react-hooks.js': Cannot find module 'eslint-plugin-react-hooks'
Require stack:

  • C:\shopify\loyalty-program-shopify_placeholder_.js
    Happened while validating C:\shopify\loyalty-program-shopify\app\routes\auth.login\route.jsx
    This can happen for a couple of reasons:
  1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc).
  2. If ESLint is installed globally, then make sure 'eslint-plugin-react-hooks' is installed globally as well.
  3. If ESLint is installed locally, then 'eslint-plugin-react-hooks' isn't installed correctly.

Consider running eslint --debug C:\shopify\loyalty-program-shopify\app\routes\auth.login\route.jsx from a terminal to obtain a trace about the configuration files used.

Note that the plugin ESLint is looking for are peer dependencies and are automatically installed by PNPM.

At the same time, the pnpm eslint . command works as expected from the command line.

A temporary workaround is adding these dependencies to package.json, but it's somewhat redundant and is cluttering the list of dependencies that are directly used by the repo. Additionally, it would be good if running ESLint from the extension would have a similar behavior to it running from the command line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    info-neededIssue requires more information from poster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions