I am very new using discord's javascript
This is also my first time posting on stackoverflow!
Anyway
Here's the full error
Error: Cannot find module 'discord.js'
Require stack:
- /home/runner/multiple-purpose-discord-bot-like-carlbot/xp.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> (/home/runner/multiple-purpose-discord-bot-like-carlbot/xp.js:1: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 Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/runner/multiple-purpose-discord-bot-like-carlbot/xp.js' ]
}
To my limited knowledge, this is either i made a typo
OR some package is outdated, here's the full packages list
I also suspect that i incorrectly implemented the amethyste-api i am using, here's my code
It's in a config file, should've i put const mySecret = process.env['ame'] in the main file instead?, I do need it to be in the config for ease of access
npm install discord.js (manually through console/shell)
did do some stuff but stil didn't work
npm xp.js (manually through console/shell)
this is what i am supposed to run on start manually, that what gives the error
You could run the following commands one after the other:
`npm init`
and then
`npm i discord.js`
Related
Trying to build (compile) an Angular 13 Ionic 6 solution after a migration to capacitor 4 (from capacitor 3) and a full npm cleanup and re-installation, Getting:
Error: Cannot find module './ponyfill.js'
Require stack:
- C:\Users\morsa\Documents\IDrive-Sync\Dev Env\Projects\simplify-pilot\node_modules\symbol-observable\lib\index.js
- C:\Users\morsa\Documents\IDrive-Sync\Dev Env\Projects\simplify-pilot\node_modules\#angular\cli\lib\init.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\morsa\Documents\IDrive-Sync\Dev Env\Projects\simplify-pilot\node_modules\symbol-observable\lib\index.js:7:17)
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:\\Users\\morsa\\Documents\\IDrive-Sync\\Dev Env\\Projects\\simplify-pilot\\node_modules\\symbol-observable\\lib\\index.js',
'C:\\Users\\morsa\\Documents\\IDrive-Sync\\Dev Env\\Projects\\simplify-pilot\\node_modules\\#angular\\cli\\lib\\init.js'
]
}
[ERROR] An error occurred while running subprocess ng.
ng.cmd run app:build exited with exit code 1.
I guess this symbol-observable is used in rxjs (at least).
I tried manually installing:
npm i ponyfill
This did install ponyfill 0.0.1
However, still getting the above error.
Any pointers on how to unstuck me? can't build the app...
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
Good morning, first I would like to apologize for my English.
I am having a problem when creating a project to follow, I am taking the following steps.
STEP 1: npm install #vue/cli
STEP 2: vue create myproject
In the second step, I have the following error.
PS C:\Users\Bruno\Desktop\vue\VUE-CLI> vue create myproject
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'lru-cache'
Require stack:
- C:\Users\Bruno\AppData\Roaming\npm\node_modules\#vue\cli\node_modules\#vue\cli-shared-utils\lib\env.js
- C:\Users\Bruno\AppData\Roaming\npm\node_modules\#vue\cli\node_modules\#vue\cli-shared-utils\index.js
- C:\Users\Bruno\AppData\Roaming\npm\node_modules\#vue\cli\bin\vue.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> (C:\Users\Bruno\AppData\Roaming\npm\node_modules\#vue\cli\node_modules\#vue\cli-shared-utils\lib\env.js:4:13)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
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: [
'C:\\Users\\Bruno\\AppData\\Roaming\\npm\\node_modules\\#vue\\cli\\node_modules\\#vue\\cli-shared-utils\\lib\\env.js',
'C:\\Users\\Bruno\\AppData\\Roaming\\npm\\node_modules\\#vue\\cli\\node_modules\\#vue\\cli-shared-utils\\index.js',
'C:\\Users\\Bruno\\AppData\\Roaming\\npm\\node_modules\\#vue\\cli\\bin\\vue.js'
]
}
PS C:\Users\Bruno\Desktop\vue\VUE-CLI>
Try using npx maybe? Ensuring you have the latest updates
npx #vue/cli create my-project
Is the folder you intend to install the project into Vue/vue-cli? Don't know if anything n there is affecting it
I want to make a new project running npm install -g create-react-app on the folder directory. After doing this I get the following error:
module.js:487
throw err;
^
Error: Cannot find module '../package.json'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:30:15
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
Your question is not very precise. You should give more details about what you are doing.
Still, here are some suggestions. Make sure:
You run the command from within the folder, where your package.json is located.
If you have not created a package.json yet, run npm init
Your package.json is a valid format and readable
I am using node.js to run one app given by my professor on my chrome. Something wrong happen, but I don't know because I am a rookie.
The structure is as follows:
/app
/models
answers.js
questions.js
sessions.js
user.js
passport.js
qmanage.js
routes.js
/config
auth.js
database.js
mcd.js
package.json
/public
some css png fonts jpg document
qloader.js
server.js
/views
some ejs document
At first, it shows this problem:
module.js:457
throw err;
^
Error: Cannot find module 'mongoose'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/shen/Desktop/os/cse303.p2/server.js:2:16)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
then, based on this help Node.js error Error: Cannot find module 'mongoose' I run npm install mongoose in my root path of project. Then I have those error below:
dyn143030:cse shen$ node server.js
{ Error: Cannot find module '../build/Release/bson'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/shen/Desktop/os/cse303.p2/node_modules/bson/ext/index.js:15:10)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3) code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
events.js:160
throw er; // Unhandled 'error' event
^
Error: Invalid mongodb uri. Missing hostname
at muri (/Users/shen/Desktop/os/cse303.p2/node_modules/muri/lib/index.js:40:11)
at NativeConnection.Connection.open (/Users/shen/Desktop/os/cse303.p2/node_modules/mongoose/lib/connection.js:195:16)
at Mongoose.connect (/Users/shen/Desktop/os/cse303.p2/node_modules/mongoose/lib/index.js:212:15)
at Object.<anonymous> (/Users/shen/Desktop/os/cse303.p2/server.js:4:10)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
I tried to find solution from this help
Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version
but it seems not my case, because I am using OS X 10.11.3
dyn143030:cse shen$ node -v
v6.5.0
dyn143030:cse shen$ npm -v
3.10.3
From my aspect, I think the system find bson someplace wrong, so how to modify it? Thanks! If any more information is need, please tell me.
I find in node_modules\bson\ext\index.js
and change path on 10th line
bson = require('../build/Release/bson'); to bson = require('bson');
You can try adding mongoose to the dependency list in the package.json file, or also doing >npm install mongoose in the project folder.