MeshJS / mesh

An open-source library to advance Web3 development on Cardano
https://meshjs.dev
Apache License 2.0
189 stars 49 forks source link

Cardano Serialization Lib error on initial setup #124

Closed shiew381 closed 1 year ago

shiew381 commented 1 year ago

Hello! Thanks Mesh team for all your work on the SDK. I attempted to follow your documentation from https://meshjs.dev/guides/nextjs exactly to set up a Next.js application, but ran into trouble trying to wrap a component in ....The stack trace is pointing to cardano-serialization-lib but I have no idea how to fix! Any help appreciated, would really love to give your SDK a try. I'm running Next version 13.4.0 and have configured Next.config.js exactly as in your documentation.

======================================= warn - ./node_modules/@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib_bg.js Critical dependency: the request of a dependency is an expression

Import trace for requested module: ./node_modules/@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib_bg.js
./node_modules/@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib.js ./node_modules/@meshsdk/core/dist/core.js ./node_modules/@meshsdk/react/dist/react.js ./app/page.tsx

./node_modules/@emurgo/cardano-serialization-lib-nodejs/cardano_serialization_lib.js Critical dependency: the request of a dependency is an expression

Import trace for requested module: ./node_modules/@emurgo/cardano-serialization-lib-nodejs/cardano_serialization_lib.js ./node_modules/@meshsdk/core/dist/core.js ./node_modules/@meshsdk/react/dist/react.js ./app/page.tsx error - Error: ENOENT: no such file or directory, open 'C:\Users\katie\Documents\WebDevelopment\nextpractice2.next\server\app\cardano_serialization_lib_bg.wasm' at Object.openSync (node:fs:600:3) at Object.readFileSync (node:fs:468:35) at webpack_require (C:\Users\katie\Documents\WebDevelopment\nextpractice2.next\server\webpack-runtime.js:33:42) at webpack_require (C:\Users\katie\Documents\WebDevelopment\nextpractice2.next\server\webpack-runtime.js:33:42) at webpack_require__ (C:\Users\katie\Documents\WebDevelopment\nextpractice2.next\server\webpack-runtime.js:33:42) at eval (./app/page.tsx:11:72) at (sc_client)/./app/page.tsx (C:\Users\katie\Documents\WebDevelopment\nextpractice2.next\server\app\page.js:1228:1) at webpack_require__ (C:\Users\katie\Documents\WebDevelopment\nextpractice2.next\server\webpack-runtime.js:33:42)

jinglescode commented 1 year ago

I just tested the instructions, seems ok. How about try starting from this starter kit? it produce the same outcome as the guide.

shiew381 commented 1 year ago

Tried the starter kit, it worked! Was able to submit my first transaction to the network. Thank you so much :)

bluekornchips commented 1 year ago

This issue is still present - it is due to it being incompatible with latest version of NextJS.

shiew381 commented 1 year ago

Hi BlueKornChips,

Thanks for the comment. I was able to get things to work with Next version 13.4.1, but found I had to switch back to the "pages router" rather than Next's new "app router". With the new "app router", did not have any luck trying to wrap the application in the context provider