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

npm ERR! code ERESOLVE occurs on npm install #335

Closed
MasaruKitajima opened this issue Jun 25, 2024 · 7 comments
Closed

npm ERR! code ERESOLVE occurs on npm install #335

MasaruKitajima opened this issue Jun 25, 2024 · 7 comments
Labels

Comments

@MasaruKitajima
Copy link

My node version is v20.12.2 and npm version is 10.5.2

When I ran npm install, I got error as followings.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/rollup
npm ERR!   dev rollup@"^4.18.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer rollup@"^2.0.0" from [email protected]
npm ERR! node_modules/rollup-plugin-terser
npm ERR!   dev rollup-plugin-terser@"^7.0.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

How can I fix these erros?

@gka
Copy link
Owner

gka commented Jul 28, 2024

I think the imports will be fixed once #336 is merged

@gka gka added the bug label Jul 28, 2024
@MasaruKitajima
Copy link
Author

Thank you so much. I'll try it later and will report.

@gka
Copy link
Owner

gka commented Jul 30, 2024

Should be fixed in 2.5.0 now, just tested it with Node v20.11.1

@clhenrick
Copy link

@gka not sure if it relates to this issue but I'm seeing "invalid module" when require'ing chroma-js on ObservableHQ. This was working fine yesterday. I see a dependabot PR was recently merged 2 hours ago, perhaps that broke something?

Example notebook: https://observablehq.com/d/7a7e8b4d8fda8036

@gka
Copy link
Owner

gka commented Aug 5, 2024

@clhenrick hm, I think that's a problem with how ObservableHQ is importing npm modules when using its require method. Confusingly, this is not the Node require method but rather an alias for d3-require, which doesn't seem to support the way chroma-js is bundled since 2.5.0.

However, you can import chroma.js using the newer import syntax (found this using the handy module require debugger notebook)

// works only in Observable Notebooks
chroma = (await import("https://unpkg.com/chroma-js")).default

Here's a demo notebook: https://observablehq.com/@gka/chroma-js

Btw, you can also import chroma from this notebook directly

// works only in Observable Notebooks
import {chroma} from "@gka/chroma-js"

Btw, importing chroma.js works fine in other places, e.g., this Svelte REPL.

@gka
Copy link
Owner

gka commented Aug 5, 2024

@MasaruKitajima I tested importing chroma.js via npm both using require and import and it works fine, so I'll close this issue now. Thanks for reporting the bug.

@gka gka closed this as completed Aug 5, 2024
@MasaruKitajima
Copy link
Author

@gka Thank you for your efforts.
I could build it successfully.
Again, many thanks for your great efforts.

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

No branches or pull requests

3 participants