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.

Cannot find module d3 or its corresponding type declarations

See original GitHub issue

Describe the Bug

After updating to v10, builds fail because it fails to find d3 or d3-transitions

node_modules/react-flow-renderer/dist/esm/types/general.d.ts:2:56 - error TS2307: Cannot find module 'd3' or its corresponding type declarations.

2 import { Selection as D3Selection, ZoomBehavior } from 'd3';
                                                         ~~~~

node_modules/react-flow-renderer/dist/esm/utils/graph.d.ts:1:42 - error TS2307: Cannot find module 'd3' or its corresponding type declarations.

1 import { Selection as D3Selection } from 'd3';
                                           ~~~~

node_modules/react-flow-renderer/dist/esm/utils/graph.d.ts:15:128 - error TS7016: Could not find a declaration file for module 'd3-transition'. 'C:/monolith/packages/hub/node_modules/d3-transition/src/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/d3-transition` if it exists or add a new declaration (.d.ts) file containing `declare module 'd3-transition';`

15 export declare const getD3Transition: (selection: D3Selection<Element, unknown, null, undefined>, duration?: number) => import("d3-transition").Transition<Element, unknown, null, undefined>;     
                                                                                                                                  ~~~~~~~~~~~~~~~

I’m using Vite v2.6.4 to build the package.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. Install react-flow-renderer
  2. run tsc && vite build
  3. Build fails

Expected behavior

Build with no errors

Screenshots or Videos

No response

Platform

react-flow-renderer: v10.3.14 vite: 2.6.3 react: 18.2.0

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
moklickcommented, Aug 17, 2022

@barneaoren @sushantdhiman Thanks! This is fixed in v10.3.16

0reactions
sushantdhimancommented, Aug 17, 2022

Hi @moklick , It is not necessary to include the react and react-dom types because they are peer dependencies that should be installed by consuming projects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module "d3" error is displayed after i upgraded my ...
Install the type declarations from npm: npm install @types/d3 --save-dev. You dont need typings. It is deprecated. The same for jquery.
Read more >
[Solved]-Error: Cannot find module 'd3'-d3.js - appsloveworld
If you are wanting to require a module you must do npm install you should do npm init first and both should be...
Read more >
Cannot find module “d3” error is displayed after i upgraded my ...
Cannot find module “d3” error is displayed after i upgraded my project from ionic 2 to ionic 3 - ionic-v3 - Ionic Forum....
Read more >
error TS7016: Could not find a declaration file for ... - GitHub
The thing is my project does not make direct use of that @types/d3 , it is a dependency of @swimlane/ngx-charts , so they...
Read more >
d3 - npm
Start using d3 in your project by running `npm i d3`. There are 4816 other projects in the npm registry using d3.
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