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.

[Bug?]: cannot find module or its corresponding type declarations after yarn link

See original GitHub issue

Self-service

  • I’d be willing to implement a fix

Describe the bug

After linking with yarn link ../node-zwave-js --all it fails to import linked packages.

To reproduce

git clone https://github.com/darkbasic/node-zwave-js.git
cd node-zwave-js
git checkout softreset
yarn && yarn build
cd ..
git clone https://github.com/darkbasic/zwavejs2mqtt.git
cd zwavejs2mqtt
git checkout feat/yarn2
yarn && yarn link ../node-zwave-js --all
yarn build:server

Environment

System:
    OS: Linux 5.14 Arch Linux
    CPU: (4) x64 Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz
  Binaries:
    Node: 14.18.0 - /tmp/xfs-a5871f4d/node
    Yarn: 3.1.0-rc.8.git.20211009.hash-b292d2b9 - /tmp/xfs-a5871f4d/yarn
    npm: 6.14.15 - ~/.nvm/versions/node/v14.18.0/bin/npm

Additional context

I’ve already updated to yarn canary because of https://github.com/yarnpkg/berry/issues/3413

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
larixercommented, Oct 12, 2021

@darkbasic I wasn’t aware that tsc supports preserveSymlinks, nice! I’m not sure what is the bug with the link, but feel free to open issue if you think there is a bug and close this one.

1reaction
forgocommented, Oct 11, 2021

I’ve also noticed this issue where typescript/intellisense just stops working when linking to a shared component library locally which doesn’t really help with the local testing-in-context purpose this would serve for us. Even though my IDE marks things as errors, it still runs without issue.

We don’t have the resources or even a real need to turn everything into a monorepo of multiple workspaces at the moment, so it would be nice to understand how this is supposed to work.

We have one coworker who simply cannot get link to work at all because of the shared component library peerDependencies (e.g. - Error: Can't resolve 'react' in <linked-build-dir>, which I think may be a separate issue, but having general reliability issues with local linking between two Yarn berry projects.

Everything has been very modernized recently with Yarn 3.0.2, Webpack 5.52.0, Typescript 4.4.2, React 17, etc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lerna, yarn, and Typescript: Cannot find module or its ...
TS2307 : Cannot find module 'money' or its corresponding type declarations. I know this issue can be resolved by adding money to the...
Read more >
A guide through The Wild Wild West of setting up a mono repo ...
Setting up a mono repo from scratch. We will be using TypeScript, Yarn workspaces, Lerna, and Jest. The release of the packages will...
Read more >
Troubleshooting | Yarn
This error simply means that the specified package is requiring something without explicitly declaring it in its dependencies. Since this behavior is unsafe...
Read more >
cannot find module 'vuex' or its corresponding type declarations
I'm still getting the following errors: At first it lists all my vue component typescript files, vuex store typescript files, and my types.ts...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
To fix the error, you need to install the package that is absent in your project directory – npm install package-name or yarn...
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