Javascript: Resolve error: unable to load resolver "node"

Created on 11 Feb 2018  路  3Comments  路  Source: airbnb/javascript

Can't understand what's the problem and how this is possible...

I just simply install airbnb config and its devDeps. Then just running eslint on 1-line .js file.

/home/charlike/code/rolldown/src/foo.js
  1:1   error  Resolve error: unable to load resolver "node"                                               import/no-unresolved
  1:1   error  Resolve error: unable to load resolver "node"                                               import/no-extraneous-dependencies
  1:1   error  'babylon' should be listed in the project's dependencies. Run 'npm i -S babylon' to add it  import/no-extraneous-dependencies
  1:1   error  Resolve error: unable to load resolver "node"                                               import/no-duplicates
  1:1   error  Resolve error: unable to load resolver "node"                                               import/extensions
  1:1   error  Resolve error: unable to load resolver "node"                                               import/no-named-as-default
  1:1   error  Resolve error: unable to load resolver "node"                                               import/no-named-as-default-member
  1:8   error  'babylon' is defined but never used                                                         no-unused-vars
  1:21  error  Unable to resolve path to module 'babylon'                                                  import/no-unresolved
  1:21  error  Missing file extension for "babylon"                                                        import/extensions

I'm seeing that there is eslint-import-resolver-node as dependency at eslint-plugin-import, so it not make sense.

Most helpful comment

Damn, i knew that. It's because Pnpm is "strict"

Strict. A package can access only dependencies that are specified in its package.json.

Probably installing eslint-import-resolver-node as dependency here will fix the issue, not sure.

All 3 comments

Damn, i knew that. It's because Pnpm is "strict"

Strict. A package can access only dependencies that are specified in its package.json.

Probably installing eslint-import-resolver-node as dependency here will fix the issue, not sure.

FYI, there's a related issue at eslint-plugin-import (https://github.com/benmosher/eslint-plugin-import/issues/828) and it has nothing to do with pnpm's strictness. The issue is caused because eslint-plugin-import preserves symlinks when it searches for "plugins". Node does not preserve symlinks when it resolves modules. Neither should eslint-plugin-import

Was this page helpful?
0 / 5 - 0 ratings