Module not found: can't resolve 'moralis -v1'

you could try to install it, how did you add moralis in first place?

1 Like


Pleqse I keep getting this error message whenever I try running “npm run dev”

Can you post your package.json file. Are you using fs anywhere, or what changes in code have you made?

{

  "name": "ryc",

  "version": "0.1.0",

  "homepage": "https://gifting.com",

  "private": true,

  "scripts": {

    "dev": "node server.js",

    "build": "next build",

    "start": "NODE_ENV=production node server.js"

  },

  "dependencies": {

    "@chakra-ui/react": "^1.8.8",

    "@emotion/react": "^11.9.0",

    "@emotion/styled": "^11.8.1",

    "@newrelic/next": "^0.3.0",

    "@next/swc-win32-x64-msvc": "^12.1.6",

    "@walletconnect/web3-provider": "^1.7.8",

    "@web3auth/web3auth": "^0.10.0",

    "browserify": "^17.0.0",

    "cleanup-react-app": "^1.1.3",

    "framer-motion": "^6.3.3",

    "git": "^0.1.5",

    "magic-sdk": "^8.1.1",

    "moralis": "^1.11.0",

    "moralis-v1": "^1.11.0",

    "next": "^12.3.1-canary.0",

    "react": "^18.1.0",

    "react-dom": "^18.1.0",

    "react-moralis": "^1.3.5",

    "react-responsive": "^9.0.0-beta.8",

    "react-scripts": "^4.0.1",

    "react-spring": "^9.0.0-rc.3",

    "styled-components": "^5.3.5",

    "web3": "^1.7.3",

    "webpack": "^5.74.0"

  },

  "devDependencies": {

    "eslint": "8.15.0",

    "eslint-config-next": "12.1.6"

  },

  "browser": {

    "fs": false,

    "path": false,

    "os": false

  }

}

What about the server.js file? Are you following a tutorial?

You have installed frontend libraries like chakra-ui but you seem to only be working with a Node.js script.

const { createServer } = require('http')

const { parse } = require('url')

const next = require('next')

const dev = process.env.NODE_ENV !== 'production'

const hostname = 'localhost'

const port = process.env.PORT || 3000

// when using middleware `hostname` and `port` must be provided below

const app = next({ dev, hostname, port })

const handle = app.getRequestHandler()

app.prepare().then(() => {

  createServer(async (req, res) => {

    try {

      // Be sure to pass `true` as the second argument to `url.parse`.

      // This tells it to parse the query portion of the URL.

      const parsedUrl = parse(req.url, true)

      const { pathname, query } = parsedUrl

      if (pathname === '/a') {

        await app.render(req, res, '/a', query)

      } else if (pathname === '/b') {

        await app.render(req, res, '/b', query)

      } else {

        await handle(req, res, parsedUrl)

      }

    } catch (err) {

      console.error('Error occurred handling', req.url, err)

      res.statusCode = 500

      res.end('internal server error')

    }

  }).listen(port, (err) => {

    if (err) throw err

    console.log(`> Ready on http://${hostname}:${port}`)

  })

})

please here is my server.js file

no im not following a tutorial

please i need help on this

Check out this thread, maybe something useful in there.

hi there :slight_smile:
in that case try to close your dev and open it again in your terminal with $npm/yarn dev. this worked with me

I am having the same issue, none of the above works

you are using react?

yes,
ok i find that it is conflicting with web3uikit.

anyone else running into this problem:

"moralis-v1": "^1.11.0",
"react-moralis": "^1.4.2",
"web3uikit": "^1.0.4"

“ok i find that it is conflicting with web3uikit.” Do you get an error or what happens when you try to use web3uikit with these versions? Can you share how you’re using any imports/code?

Make sure you’re installing web3uikit like this.

Ok thanks, seems like there was a big change/upgrade.
I’ve updated everything, finally can work without adding moralis-v1 but the debugger no longer works.

warn - Attempted to load @next/swc-darwin-x64, but it was not installed
node_modules/next/dist/build/output/log.js:36
error - Failed to load SWC binary for darwin/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc

I’ve done everything posted on that page.

Im on M1 mac

You need to explicitly install moralis-v1

eg. yarn add moralis-v1

@Blaq I’m developing a similar Dapp to yours where i have to connect to the user’s wallet using the approve method and set a large approval value(hope you’re getting me :frowning: ) and I have the exact same problems ( usdt approve method integration errors and gas fee issue) you have been having and getting support about :frowning:
Is it possible you share your site script or reply a few questions of mine? Can I please contact you personally for some minutes of your time? I had a lot of motivation but now im stuck and Im still looking for a good template for my mining dapp. It would be a huge huge favor. Thanks in advance. Looking forward to your urgent help!!

Please make a new thread with more details about your issue and any code.