Comments (8)
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 😅)
from eth-sdk.
I just downloaded the .zip archive of the latest release the index.mjs
file exists within the client
folder. So this issue might be yarn-related which misses out some files during install?
from eth-sdk.
@wottpal I assume that you want to use eth-sdk with vite, is that correct? Have you checked out our example? https://github.com/dethcrypto/eth-sdk/tree/master/examples/vite-react
CC: @hasparus
from eth-sdk.
Hey thanks for your quick response. Actually I don't want to use it with vite, I just tried out your example 😅 (the one you linked to). I installed dependencies with yarn and did the postinstall task, but then the error I posted above happens...
index.mjs
seems to be missing with the yarn installation for me 🤷♂️
from eth-sdk.
I can't reproduce it locally :/ Have you run yarn build
in the root directory?
You can also check out our CI scripts for step by step instructions: https://github.com/dethcrypto/eth-sdk/blob/master/.github/workflows/ci.yml
from eth-sdk.
Thanks, that's weird. Yes, I did try the build
-task.
I reproduced it once again with the following versions. Oh and I'm on an M1 MacBook if that makes any difference...
➜ Developer node --version
v16.13.0
➜ Developer npm --version
8.1.4
➜ Developer yarn --version
1.22.17
➜ Developer tsc --version
Version 4.5.2
This is the output. FYI degit is a tool to clone a single directory. But the behavior is the same if I would clone with good'ol git :)
➜ Developer degit dethcrypto/eth-sdk/examples/vite-react vite-react
> cloned dethcrypto/eth-sdk#HEAD to vite-react
➜ Developer cd vite-react
➜ vite-react ls
README.md eth-sdk hardhat.config.ts index.html package.json src tsconfig.json vite.config.ts
➜ vite-react yarn add --dev @dethcrypto/eth-sdk @dethcrypto/eth-sdk-client typescript ts-node
yarn add v1.22.17
info No lockfile found.
[1/4] 🔍 Resolving packages...
warning hardhat > [email protected]: Deprecated in favor of '@metamask/eth-sig-util'
warning hardhat > mocha > [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
warning hardhat > mocha > chokidar > [email protected]: "Please update to latest v2.3 or v2.2"
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning "@dethcrypto/eth-sdk > @typechain/[email protected]" has unmet peer dependency "@ethersproject/bytes@^5.0.0".
warning "@dethcrypto/eth-sdk > @typechain/[email protected]" has unmet peer dependency "@ethersproject/providers@^5.0.0".
warning "@dethcrypto/eth-sdk > @typechain/[email protected]" has unmet peer dependency "@ethersproject/abi@^5.0.0".
warning " > @dethcrypto/[email protected]" has unmet peer dependency "@ethersproject/abi@^5".
warning " > @dethcrypto/[email protected]" has unmet peer dependency "@ethersproject/abstract-provider@^5".
warning " > @dethcrypto/[email protected]" has unmet peer dependency "@ethersproject/bignumber@^5".
warning " > [email protected]" has unmet peer dependency "@types/node@*".
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
warning "@dethcrypto/eth-sdk" is already in "dependencies". Please remove existing entry first before adding it to "devDependencies".
warning "@dethcrypto/eth-sdk-client" is already in "dependencies". Please remove existing entry first before adding it to "devDependencies".
success Saved 348 new dependencies.
info Direct dependencies
├─ @dethcrypto/[email protected]
├─ @dethcrypto/[email protected]
├─ @nomiclabs/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @vitejs/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
info All dependencies
[...]
$ yarn generate-types
yarn run v1.22.17
$ eth-sdk
Loaded sdk definition from /Users/wottpal/Developer/vite-react/eth-sdk
✔ Getting ABIs
✔ Generating client
SDK generated to: node_modules/.dethcrypto/eth-sdk-client
✨ Done in 2.31s.
✨ Done in 24.18s.
➜ vite-react yarn build
yarn run v1.22.17
$ tsc && vite build
vite v2.6.14 building for production...
✓ 24 modules transformed.
[vite:resolve] 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.
error during build:
Error: 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.
at packageEntryFailure (/Users/wottpal/Developer/vite-react/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:30273:11)
at resolvePackageEntry (/Users/wottpal/Developer/vite-react/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:30269:9)
at tryNodeResolve (/Users/wottpal/Developer/vite-react/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:30044:11)
at Object.resolveId (/Users/wottpal/Developer/vite-react/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:29910:28)
at /Users/wottpal/Developer/vite-react/node_modules/rollup/dist/shared/rollup.js:22706:25
at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
➜ vite-react cd node_modules/@dethcrypto/eth-sdk-client
➜ eth-sdk-client ls -al
total 48
drwxr-xr-x 9 wottpal staff 288 Nov 25 08:58 .
drwxr-xr-x 4 wottpal staff 128 Nov 25 08:58 ..
-rw-r--r-- 1 wottpal staff 103 Nov 23 16:18 CHANGELOG.md
-rw-r--r-- 1 wottpal staff 1057 Nov 23 16:18 LICENSE
-rw-r--r-- 1 wottpal staff 537 Nov 23 16:18 README.md
-rw-r--r-- 1 wottpal staff 43 Nov 23 16:18 index.d.ts
-rw-r--r-- 1 wottpal staff 76 Nov 23 16:18 index.js
-rw-r--r-- 1 wottpal staff 1143 Nov 23 16:18 package.json
drwxr-xr-x 3 wottpal staff 96 Nov 25 08:58 types
As you might see the yarn build
-task generates the initial error of this issue. And the index.mjs
file is missing after installation 🤷♂️
OT: You should add typescript and ts-node to dev-dependencies IMO.
from eth-sdk.
Hey @wottpal! Thanks for finding this bug 🙏
It turns out index.mjs
was missing from "files"
list in package.json, so it didn't get published.
I just created a PR with a fix: #55,
However, I have a workaround until it's merged.
As the only thing that's broken is @dethcrypto/eth-sdk-client
, you can use @dethcrypto/eth-sdk
without it by specifying config.outputPath
in your eth-sdk.config.ts
file.
Sorry for the trouble!
from eth-sdk.
Fixed in: https://github.com/dethcrypto/eth-sdk/releases/tag/%40dethcrypto/eth-sdk%400.2.3
from eth-sdk.
Related Issues (20)
- Documentation about dockerization process HOT 1
- Does not work with Yarn Monorepos HOT 3
- Support alternatives to ts-node
- eth-sdk fails to fetch ABI for some contracts: invalid ABI fetched instead HOT 2
- Sometimes eth-sdk fails to generate client HOT 3
- Handling proxy contracts with implementation abi missing proxy abi HOT 2
- unmet peer typechain@^8.1.0: found 8.0.0 in @dethcrypto/eth-sdk
- Does not work with `pnpm`
- Allow custom package name & version for the generated sdk HOT 1
- Same contract & ABI, many networks HOT 2
- New addresses for old names don't override ABIs
- eth-sdk
- Using this from within a library?
- Polygonscan needs an API key HOT 1
- Doesn't follow all proxies HOT 1
- Get a single contract from SDK
- Support zkSync2 testnet? HOT 2
- Allow using Provider instead of Signer when creating SDK. HOT 2
- Reexport generated struct types HOT 5
- Allow for descriminate-types options and other typechain flags
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eth-sdk.