Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resolve 'ducd' when importing module #28

Open
JudeMH opened this issue Aug 21, 2020 · 2 comments
Open

Can't resolve 'ducd' when importing module #28

JudeMH opened this issue Aug 21, 2020 · 2 comments

Comments

@JudeMH
Copy link

JudeMH commented Aug 21, 2020

Describe the bug
When I try to use this module from a React app after installing it with npm,

To Reproduce
Steps to reproduce the behavior:

  1. Create a React app: npx create-react-app test
  2. Install the module in the app: npm i d3-hypertree
  3. Import the module in src/App.js: import * as hyt from 'd3-hypertree';
  4. Start the app: npm start
  5. This error appears on the console:
Failed to compile.

./node_modules/d3-hypertree/dist/js/components/hypertree/hypertree.js
Module not found: Can't resolve 'ducd' in '/Users/jude/git/test/test/node_modules/d3-hypertree/dist/js/components/hypertree'

Expected behavior
The contents of the module should be imported without error.

Screenshots
Here's the error in the browser:
Screen Shot 2020-08-21 at 5 11 50 PM

Desktop (please complete the following information):

  • OS: macOS Catalina Version 10.15.5
  • Browser: Firefox 78.0.2 (64-bit)
  • Version: See above

Smartphone (please complete the following information):
N/A

Additional context
None

NOTE: Unfortunately, I won't be able to participate in further discussion in this thread.

@tsathoqqua
Copy link

Reproduced this today following instructions above.

@nbereux
Copy link

nbereux commented Nov 19, 2021

I stumbled upon the same problem and I managed to fix it by :

  • cloning the repo at https://github.com/glouwa/ducd.git
  • downgrading my node version to 10.17.0
  • running npm install
  • running gulp build at the root of the ducd repository
  • copying the generated dist in the ducd folder in node_modules in my project

The explanation is that when you run npm install ducd, the package is missing the source code (there is no dist folder).
So when you require ducd, the main referenced in ducd/package.json doesn't exist and npm can't resolve the package.

Hope it helps (even if it's a bit late).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants