PatrickAlphaC / nextjs-smartcontract-lottery-fcc

60 stars 87 forks source link

Module not found (Moralis related) #48

Open Sammycoderr opened 1 year ago

Sammycoderr commented 1 year ago

I keep getting this while trying to run yarn dev.. I've changed versions of my Moralis packages several times, even switched between Moralis and moralis-v1. also re-added node_modules. But still stuck

error - ./node_modules/react-moralis/lib/index.esm.js:3:0
Module not found: Can't resolve 'moralis-v1'

Import trace for requested module:
./pages/_app.js

https://nextjs.org/docs/messages/module-not-found
wait  - compiling...
error - ./node_modules/react-moralis/lib/index.esm.js:3:0
Module not found: Can't resolve 'moralis-v1
danielvichinyan commented 3 months ago

The fix for me was to use the package.json of the main branch from the repo. I tried to setup a new project, but it seems like there's some version problem. You can try with the following:

{
    "name": "lottery",
    "version": "0.1.0",
    "private": true,
    "scripts": {
        "dev": "next dev",
        "build": "next build",
        "start": "next start",
        "lint": "next lint"
    },
    "dependencies": {
        "@web3uikit/core": "^0.1.5",
        "@web3uikit/icons": "^0.1.5",
        "@web3uikit/web3": "^0.1.5",
        "autoprefixer": "10.4.14",
        "magic-sdk": "^17.1.3",
        "moralis": "^1.3.2",
        "moralis-v1": "^1.12.0",
        "next": "13.3.4",
        "react": "18.2.0",
        "react-dom": "18.2.0",
        "react-moralis": "^1.3.1",
        "tailwindcss": "3.3.2",
        "web3uikit": "^0.1.75"
    }
}
Emritik commented 1 month ago

I keep getting this while trying to run yarn dev.. I've changed versions of my Moralis packages several times, even switched between Moralis and moralis-v1. also re-added node_modules. But still stuck

error - ./node_modules/react-moralis/lib/index.esm.js:3:0
Module not found: Can't resolve 'moralis-v1'

Import trace for requested module:
./pages/_app.js

https://nextjs.org/docs/messages/module-not-found
wait  - compiling...
error - ./node_modules/react-moralis/lib/index.esm.js:3:0
Module not found: Can't resolve 'moralis-v1

you can run "yarn add moralis-v1" Screenshot 2024-07-30 014840