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.

imports do not find packages linked via 'yarn link'

See original GitHub issue

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes 1.3.2

Which terms did you search for in User Guide?

failed to compile for yarn linked packages cannot resolve local packages module not found when importing npm linked pacakges

Environment

yarn --version 1.3.2 node -v v8.9.1 npm -v 5.5.1 yarn --version 1.3.2 npm ls react-scripts └── react-scripts@1.0.17

Then, specify:

  1. Operating system: OSX 10.13.1
  2. Browser and version (if relevant): FF, Chrome, Safari

Steps to Reproduce

(Write your steps here:)

  1. Clone a module (i.e. https://github.com/jakezatecky/react-checkbox-tree )
  2. cd into that directory
  3. yarn link
  4. cd into main project
  5. yarn link ‘react-checkbox-tree’
  6. Add import CheckboxTree from ‘react-checkbox-tree’; to a component
  7. Run

Expected Behavior

It should resolve the module.

Actual Behavior

I see the module is symlinked within node_modules, but the app is looking only relative to the component:

Failed to Compile Module not found: Can’t resolve ‘react-checkbox-tree’ in ‘/Users/un/gd/client/src/modules/categories/components’

Reproducible Demo

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
gaearoncommented, Feb 3, 2018

It is failing because the main entry of react-checkbox-tree points to lib/index.js. But that file doesn’t exist if you just clone a repository.

If you run yarn build in react-checkbox-tree, that will create the lib folder. If you manage to get it building (I had to remove linters from the gulpfile because they failed for me), linking will work.

0reactions
zedtuxcommented, Jul 19, 2018

Oh … thank you @bugzpodder

Read more comments on GitHub >

github_iconTop Results From Across the Web

yarn link
yarn link (in package you want to link)​​ This command is run in the package folder you'd like to consume. For example if...
Read more >
Import from `yarn link` packages not working - Stack Overflow
I have a package structure as follows -> projectA -> libA ->dist/ ->index.js index.ts package.json. I compiled the package libA using ...
Read more >
How to yarn link when the package is not published?
There's a problem. This only works if you've previously published the package to an npm compatible repository because when you run yarn in...
Read more >
Support resolve and auto import for npm linked packages
Open the project - web40509-npm-link -> cd pkg6 -> npm link · Open the attached project - npm-link-test1. · Try to import pkg6...
Read more >
How to Test npm Packages Locally - Alyssa Holland's Blog
yarn link is a CLI command that allows developers to link a package in ... dependencies linked in this way are not saved...
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