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.

error about package.json module-definition when running vite-example

See original GitHub issue

yarn dev produces the following output after installing dependencies and running yarn eth-sdk successfully.

[vite]    src/App.tsx:1:30: note: The plugin "vite:dep-scan" was triggered by this import
[vite]         1 │ import { getMainnetSdk } from '@dethcrypto/eth-sdk-client'
[vite]           ╵                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[vite] 
[vite] error when starting dev server:
[vite] Error: Build failed with 1 error:
[vite] node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:30273:10: error: [plugin: vite:dep-scan] Failed to resolve entry for package "@dethcrypto/eth-sdk-client". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "@dethcrypto/eth-sdk-client". The package may have incorrect main/module/exports specified in its package.json.
[vite]     at failureErrorWithLog (/Users/wottpal/Developer/eth-sdk-example-react/node_modules/esbuild/lib/main.js:1493:15)
[vite]     at /Users/wottpal/Developer/eth-sdk-example-react/node_modules/esbuild/lib/main.js:1151:28
[vite]     at runOnEndCallbacks (/Users/wottpal/Developer/eth-sdk-example-react/node_modules/esbuild/lib/main.js:941:63)
[vite]     at buildResponseToResult (/Users/wottpal/Developer/eth-sdk-example-react/node_modules/esbuild/lib/main.js:1149:7)
[vite]     at /Users/wottpal/Developer/eth-sdk-example-react/node_modules/esbuild/lib/main.js:1258:14
[vite]     at /Users/wottpal/Developer/eth-sdk-example-react/node_modules/esbuild/lib/main.js:629:9
[vite]     at handleIncomingPacket (/Users/wottpal/Developer/eth-sdk-example-react/node_modules/esbuild/lib/main.js:726:9)
[vite]     at Socket.readFromStdout (/Users/wottpal/Developer/eth-sdk-example-react/node_modules/esbuild/lib/main.js:596:7)
[vite]     at Socket.emit (node:events:390:28)
[vite]     at addChunk (node:internal/streams/readable:315:12)

The important part might be: The package may have incorrect main/module/exports specified in its package.json.

When I delete line 22 ("module": "./index.mjs") from node_modules/@dethcrypto/eth-sdk-client/package.json everything runs again without errors. I tried doing that because there is no index.mjs existing in the eth-sdk-client-folder.

Running on Node v16.13.0.

Thanks in advance 👋

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
wottpalcommented, Nov 25, 2021

Thanks for your quick response & fix to both of my issues. Just started playing around with blockchain development a few days ago and this library is awesome. It feels very natural for a newbie (I mean why would anyone manually copy & commit interfaces/type-declarations from other repositories?! Sounds strange 😅)

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm error - verify that the package.json has a valid "main" entry
Im playing around with a simple trading bot using binance and cctx. when i run my script with node index ...
Read more >
package.json - npm Docs
This document is all you need to know about what's required in your package.json file. It must be actual JSON, not just a...
Read more >
Create a package.json File | heynode.com
When you run npm init to generate a package.json, you can accept the suggested defaults, or fill out your own information. In this...
Read more >
package-lock.json file not updated after package.json ... - GitHub
I'm opening this issue because: npm is crashing. npm is producing an incorrect install. npm is doing something I don't understand.
Read more >
npm, pnpm, and Yarn | IntelliJ IDEA Documentation - JetBrains
IntelliJ IDEA also lets you run and debug npm, Yarn, and pnpm scripts. IntelliJ IDEA parses package.json files, recognizing definitions of ...
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