ERROR: Not finding main entrance

Hello there
I have a problem where if I try to run my discord bot it doesn’t start up
Heres the code:
{
“name”: “Mrs Doge”,
“version”: “1.0.0”,
“description”: “The almighty Mrs doge herself”,
“main”: “bot”,
“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”
},
“author”: “MrJoruz”,
“license”: “ISC”,
“dependencies”: {
“discord.js”: “^11.5.1”
}
}

And here is the error:

internal/modules/cjs/loader.js:305
throw err;
^

Error: Cannot find module ‘C:\Users(My irl name)\Desktop\DC bots\Joruz\ bot.js’. Please verify that the package.json has a valid “main” entry
at tryPackage (internal/modules/cjs/loader.js:297:19) at Function.Module._findPath (internal/modules/cjs/loader.js:528:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:784:27)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
at internal/main/run_main_module.js:17:11 {
code: ‘MODULE_NOT_FOUND’,
path: ‘C:\Users\ (My irl name)\Desktop\DC bots\Joruz\package.json’,
requestPath: ‘C:\Users\(My irl name)\Desktop\DC bots\Joruz’
}

I hope that someone can help me with this.
Have a great day
MrJoruz

Can I see your package.json file please?

the code that i gave was the package.json
but if you meant package-lock.json then that is this:

{

“name”: “joruz”,

“version”: “1.0.0”,

“lockfileVersion”: 1,

“requires”: true,

“dependencies”: {

"async-limiter": {

  "version": "1.0.1",

  "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",

  "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="

},

"discord.js": {

  "version": "11.5.1",

  "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.5.1.tgz",

  "integrity": "sha512-tGhV5xaZXE3Z+4uXJb3hYM6gQ1NmnSxp9PClcsSAYFVRzH6AJH74040mO3afPDMWEAlj8XsoPXXTJHTxesqcGw==",

  "requires": {

    "long": "^4.0.0",

    "prism-media": "^0.0.3",

    "snekfetch": "^3.6.4",

    "tweetnacl": "^1.0.0",

    "ws": "^6.0.0"

  }

},

"long": {

  "version": "4.0.0",

  "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",

  "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="

},

"prism-media": {

  "version": "0.0.3",

  "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-0.0.3.tgz",

  "integrity": "sha512-c9KkNifSMU/iXT8FFTaBwBMr+rdVcN+H/uNv1o+CuFeTThNZNTOrQ+RgXA1yL/DeLk098duAeRPP3QNPNbhxYQ=="

},

"snekfetch": {

  "version": "3.6.4",

  "resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz",

  "integrity": "sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw=="

},

"tweetnacl": {

  "version": "1.0.1",

  "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz",

  "integrity": "sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A=="

},

"ws": {

  "version": "6.2.1",

  "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",

  "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",

  "requires": {

    "async-limiter": "~1.0.0"

  }

}

}

}

Hi can you wrap the peices of code with 3 backticks (```) so it gets formatted? :slight_smile:

Ok here it is

{
  "name": "Mrs Doge",
  "version": "1.0.0",
  "description": "The almighty Mrs doge herself",
  "main": "bot",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "MrJoruz",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^11.5.1"
  }
}

And this is the locked version

{
  "name": "joruz",
  "version": "1.0.0",
  "lockfileVersion": 1,
  "requires": true,
  "dependencies": {
    "async-limiter": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
      "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
    },
    "discord.js": {
      "version": "11.5.1",
      "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.5.1.tgz",
      "integrity": "sha512-tGhV5xaZXE3Z+4uXJb3hYM6gQ1NmnSxp9PClcsSAYFVRzH6AJH74040mO3afPDMWEAlj8XsoPXXTJHTxesqcGw==",
      "requires": {
        "long": "^4.0.0",
        "prism-media": "^0.0.3",
        "snekfetch": "^3.6.4",
        "tweetnacl": "^1.0.0",
        "ws": "^6.0.0"
      }
    },
    "long": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
      "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
    },
    "prism-media": {
      "version": "0.0.3",
      "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-0.0.3.tgz",
      "integrity": "sha512-c9KkNifSMU/iXT8FFTaBwBMr+rdVcN+H/uNv1o+CuFeTThNZNTOrQ+RgXA1yL/DeLk098duAeRPP3QNPNbhxYQ=="
    },
    "snekfetch": {
      "version": "3.6.4",
      "resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz",
      "integrity": "sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw=="
    },
    "tweetnacl": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz",
      "integrity": "sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A=="
    },
    "ws": {
      "version": "6.2.1",
      "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
      "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
      "requires": {
        "async-limiter": "~1.0.0"
      }
    }
  }
}

And heres the error message

internal/modules/cjs/loader.js:305
      throw err;
      ^

Error: Cannot find module 'C:\Users\(my irl name)\Desktop\DC bots\Joruz\ bot.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:297:19)    at Function.Module._findPath (internal/modules/cjs/loader.js:528:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:784:27)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  path: 'C:\\Users\\(my irl name)\\Desktop\\DC bots\\Joruz\\package.json',
  requestPath: 'C:\\Users\\(my irl name)\\Desktop\\DC bots\\Joruz'

Can you change package-lock.json to:

{
  "name": "joruz",
  "version": "1.0.0",
  "lockfileVersion": 1,
  "requires": true,
"main": "bot.js",
  "dependencies": {
    "async-limiter": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
      "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
    },
    "discord.js": {
      "version": "11.5.1",
      "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.5.1.tgz",
      "integrity": "sha512-tGhV5xaZXE3Z+4uXJb3hYM6gQ1NmnSxp9PClcsSAYFVRzH6AJH74040mO3afPDMWEAlj8XsoPXXTJHTxesqcGw==",
      "requires": {
        "long": "^4.0.0",
        "prism-media": "^0.0.3",
        "snekfetch": "^3.6.4",
        "tweetnacl": "^1.0.0",
        "ws": "^6.0.0"
      }
    },
    "long": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
      "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
    },
    "prism-media": {
      "version": "0.0.3",
      "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-0.0.3.tgz",
      "integrity": "sha512-c9KkNifSMU/iXT8FFTaBwBMr+rdVcN+H/uNv1o+CuFeTThNZNTOrQ+RgXA1yL/DeLk098duAeRPP3QNPNbhxYQ=="
    },
    "snekfetch": {
      "version": "3.6.4",
      "resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz",
      "integrity": "sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw=="
    },
    "tweetnacl": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz",
      "integrity": "sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A=="
    },
    "ws": {
      "version": "6.2.1",
      "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
      "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
      "requires": {
        "async-limiter": "~1.0.0"
      }
    }
  }
}

assuming your main server file is called bot.js

It still gives the same error :confused:

@MrJoruz, can you run ls in the terminal (in the same directory as the package.json) and post the results here?

If i just do ls i get:

Directory: C:\Users\(my irl name)\Desktop\DC bots\Joruz

Mode LastWriteTime Length Name


d----- 8-12-2019 12:13 node_modules
-a---- 9-8-2020 15:45 303 bot.js
-a---- 9-8-2020 17:10 2096 package-lock.json
-a---- 20-4-2020 21:23 293 package.json

If i do ls package.json i get

Directory: C:\Users\(my irl name)\Desktop\DC bots\Joruz

Mode LastWriteTime Length Name


-a---- 20-4-2020 21:23 293 package.json