When I start my discord bot I get an error on the console:
internal/modules/cjs/loader.js:834
throw err;
^
Error: Cannot find module 'discord.js'
Require stack:
- /home/container/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/container/index.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/container/index.js' ]
}
But if there is an "index.js"
You need to install discord.js, in your console type npm install discord.js
Related
I tried running this function "node server/index.js" to locally view the app, it gave me the following error. Why are my having the error statements Error: Cannot find module 'typeorm'
The bellow shows all the error message
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'typeorm'
Require stack:
- C:\Users\olani\Desktop\TouristWebscraping\server\db.js
- C:\Users\olani\Desktop\TouristWebscraping\server\index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\olani\Desktop\TouristWebscraping\server\db.js:3:17)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\olani\\Desktop\\TouristWebscraping\\server\\db.js',
'C:\\Users\\olani\\Desktop\\TouristWebscraping\\server\\index.js'
]
}
I buy a react theme from theme forest and trying to open it I install npm and then I execute the command npm start and I get the error showing bellow. I send a message to developer he reply back and said execute the command npm install react-dev-utils --save
I try this but still getting the same error.
So can anyone help me to resolve this problem.
PS C:\Theme\reactjs\Template> npm start
> Artha#0.1.0 start
> node scripts/start.js
node:internal/modules/cjs/loader:936
throw err;
^
**Error: Cannot find module 'react-dev-utils/WatchMissingNodeModulesPlugin'**
Require stack:
- C:\Theme\reactjs\Template\config\webpack.config.js
- C:\Theme\reactjs\Template\scripts\start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Theme\reactjs\Template\config\webpack.config.js:16:39)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Theme\\reactjs\\Template\\config\\webpack.config.js',
'C:\\Theme\\reactjs\\Template\\scripts\\start.js'
]
}
Sometime I am getting this error
PS C:\Theme\reactjs\Template> npm start
> Artha#0.1.0 start
> node scripts/start.js
node:internal/modules/cjs/loader:936
throw err;
^
**Error: Cannot find module 'react-dev-utils/typescriptFormatter'**
Require stack:
- C:\Theme\reactjs\Template\config\webpack.config.js
- C:\Theme\reactjs\Template\scripts\start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Theme\reactjs\Template\config\webpack.config.js:23:29)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Theme\\reactjs\\Template\\config\\webpack.config.js',
'C:\\Theme\\reactjs\\Template\\scripts\\start.js'
]
}
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'node:events'
Require stack:
- D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\node_modules\discord.js\src\client\BaseClient.js
- D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\node_modules\discord.js\src\index.js
- D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\node_modules\discord.js\src\client\BaseClient.js:3:22)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'D:\\UserProfile\\Users\\Administrator\\Desktop\\misc\\SerriedZ V.2\\node_modules\\discord.js\\src\\client\\BaseClient.js',
'D:\\UserProfile\\Users\\Administrator\\Desktop\\misc\\SerriedZ V.2\\node_modules\\discord.js\\src\\index.js',
'D:\\UserProfile\\Users\\Administrator\\Desktop\\misc\\SerriedZ V.2\\index.js'
]
}
I'm getting this error while running node . to run the discord bot, I have tried to fix it by using npm i node:events but didn't seem to fix.
It might be because you are running an older version of Node.js. Try upgrading to a later version.
From Discord.js docs:
Node.js 16.6.0 or newer is required
https://discord.js.org/#/docs/discord.js/stable/general/welcome
The error is :
^
Error: Cannot find module 'discord.js'
Require stack:
- /app/bot.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
at Function.Module._load (internal/modules/cjs/loader.js:526:27)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/app/bot.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
internal/modules/cjs/loader.js:613
throw err;
^
Error: Cannot find module 'discord.js'
Require stack:
- /app/bot.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
at Function.Module._load (internal/modules/cjs/loader.js:526:27)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/app/bot.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
I don't know how to make it find discord.js.
Thank you for answers !
Here are the files contained in the project
What about package? Did you added discord.js
from package.json?
if you don't know I'll try to explain : go to package.json and click to add packages and type discord.js to there. And click the first thing you see. I hope it works!
I've used node and npm before in one or two projects, but I'm not really proficient with it. I now want to initialize a new project on MacOS by using npm init, but I get this:
$ npm init
module.js:540
throw err;
^
Error: Cannot find module 'process-nextick-args'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:26:23)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
Any idea what could be wrong here?
[EDIT]
I just tried the suggestion by #kgangadhar , but the result is the same:
$ sudo npm install -g process-nextick-args
module.js:540
throw err;
^
Error: Cannot find module 'process-nextick-args'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:26:23)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)