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.

@types/zen-observable missing in dependencies list

See original GitHub issue

Problem

This lib is compiled to use @types/zen-observable as a shadow dependency. This won’t be a problem in node_modules as @apollo/client -> zen-observable-ts -> @types/zen-observable.

But it throws when used with yarn v2 PnP where shadow dependency is strictly forbidden. An example output is:

../../.yarn/__virtual__/@apollo-client-virtual-65fb8a2b1f/0/cache/@apollo-client-npm-3.4.8-69b6059fd9-07e4f32545.zip/node_modules/@apollo/client/link/utils/fromError.d.ts:1:23 - error TS2688: Cannot find type definition file for 'zen-observable'.
/// <reference types="zen-observable" />

There are dozens of such errors. After a quick glance at the code, I found that the source code does not use the shadow dependency at all, it is solely a result of the ts compilation.

Workaround

yarn v2 provides a way to patch the deps of packages:

# .yarnrc.yml
packageExtensions:
  "@apollo/client@*":
    dependencies:
      "@types/zen-observable": "*"

Solution

As simply patching @apollo/client with a dependency eradicates the errors, the straight forward solution would be fixing the dependencies list.

I have found a relating issue #2405 . It was once fixed but now on master branch the dependencies are removed again.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
onichandamecommented, Aug 25, 2021

My project has switched from PnP to node modules for ESM support, so I cannot reproduce the error in the original project.

Having tested @apollo/client@3.5.0-beta.8 in a fresh new project with PnP enabled, it worked! Thanks a lot for your quick action 😛

0reactions
benjamncommented, Aug 24, 2021

@onichandame Can you try with @apollo/client@3.5.0-beta.8 (just published)? When I install that version, I no longer see the comments

/// <reference types="zen-observable" />

so I’m hopeful your issue will be solved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native throwing missing dependency error
I tried to install "@types/react" manually but got no success. It keeps asking to install types for react. I also check the Github...
Read more >
Resolving missing dependencies - Zendesk help
First, for each condition and action in the sandbox trigger, check all references in production until you find any that are missing.
Read more >
List missing dependencies of uninstalled package - Ask Fedora
Is there a way to get a list of missing capabilities and packages that provide them for a given uninstalled package? Similar to...
Read more >
Troubleshoot: Missing Dependencies | Revit 2021
In the Workspace References list, a missing dependency (package) displays a red X. Click the missing dependency. To install the package, ...
Read more >
Apache Maven Dependency Plugin – dependency:list
Displays the list of dependencies for this project. Attributes: Requires a Maven project to be executed. Requires dependency resolution of artifacts in scope: ......
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