question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm 5 link / lerna resolve issue

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.13.1
  • Node Version: 8.9.3
  • npm Version: 5.6.0

What parser (default, Babel-ESLint, etc.) are you using? default

Issue: When using Lerna with npm v5, eslint is unable to correctly resolve linked packages.

Example Repo: chrisblossom/eslint-issue-9746

Updated repo to include both scoped and non-scoped example.

What actually happened? Please include the actual, raw output from ESLint.

➜  example git:(master) eslint index.js
Cannot find module '@chrisblossom/eslint-config'
Referenced from: /Users/chris/github/eslint-issue-9746/packages/example/.eslintrc.js
Error: Cannot find module '@chrisblossom/eslint-config'
Referenced from: /Users/chris/github/eslint-issue-9746/packages/example/.eslintrc.js
    at ModuleResolver.resolve (/Users/chris/github/eslint-issue-9746/node_modules/eslint/lib/util/module-resolver.js:74:19)
    at resolve (/Users/chris/github/eslint-issue-9746/node_modules/eslint/lib/config/config-file.js:471:25)
    at load (/Users/chris/github/eslint-issue-9746/node_modules/eslint/lib/config/config-file.js:542:26)
    at configExtends.reduceRight (/Users/chris/github/eslint-issue-9746/node_modules/eslint/lib/config/config-file.js:421:36)
    at Array.reduceRight (<anonymous>)
    at applyExtends (/Users/chris/github/eslint-issue-9746/node_modules/eslint/lib/config/config-file.js:403:28)
    at loadFromDisk (/Users/chris/github/eslint-issue-9746/node_modules/eslint/lib/config/config-file.js:514:22)
    at Object.load (/Users/chris/github/eslint-issue-9746/node_modules/eslint/lib/config/config-file.js:550:20)
    at Config.getLocalConfigHierarchy (/Users/chris/github/eslint-issue-9746/node_modules/eslint/lib/config.js:228:44)
    at Config.getConfigHierarchy (/Users/chris/github/eslint-issue-9746/node_modules/eslint/lib/config.js:180:43)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
chrisblossomcommented, Jan 10, 2018

I do not think this issue should be closed. I still think this is a bug and eslint should work as expected with npm link/lerna without additional configuration. I’ve updated the example repo with a babel example that works as expected.

3reactions
not-an-aardvarkcommented, Dec 29, 2017

This is happening because lerna is installing eslint and your scoped config into two different locations. ESLint needs to be able to resolve your shareable config from the location of ESLint itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@lerna/link - npm
Start using @lerna/link in your project by running `npm i @lerna/link`. There are 4 other projects in the npm registry using @lerna/link.
Read more >
Setting up a monorepo with Lerna for a TypeScript project
To install necessary dependencies from npm, or link ones from the monorepo, use the lerna add command from the root of the project....
Read more >
Unable to resolve dependency tree error when installing npm ...
You have dependency conflict (incorrect and potentially broken dependency) as it says, so try to run the command with --force , or --legacy-peer ......
Read more >
@lerna/link | Yarn - Package Manager
json. (Please let us know via a Github issue if you feel the need to do that, however, as in general the new...
Read more >
How to fix NPM link duplicate dependencies issues
This post is about an issue that keeps coming on several of my projects involving third-party libraries linked locally with npm link: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found