I can't start my bot at all I looked all over online discord.js - node.js

PS C:\Users\jorda\OneDrive\Documents\discordbots\jordangaming05> node .
node:internal/modules/cjs/loader:1056
throw err;
^
Error: Cannot find module 'C:\Users\jorda\OneDrive\Documents\discordbots\jordangaming05'
at Module._resolveFilename (node:internal/modules/cjs/loader:1053:15)
at Module._load (node:internal/modules/cjs/loader:898:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:84:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I try to do npm i I also install Discord.js and I can not find any solution online this is my last place for this I am trying to start up the bot with discord.js and I got nothing

Related

Error installing Vue3 on the command line

I acted according to the video tutorial Laravel 9 and Vue 3 SPA online store 10. Creating a project on vue3, the client part of the online store. See from 1:00-3:00. When executing the command
npm init vue#latest
I received an error
Microsoft Windows [Version 6.1.7601]
(c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.
C:\Windows\system32>cd C:\OpenServer\domains\clientpart
C:\OpenServer\domains\clientpart>npm init vue#latest
npx: installed 1 in 31.943s
C:\Users\1\AppData\Roaming\npm-cache\_npx\7892\node_modules\create-vue\outfile.c
js:3856
const isFeatureFlagsUsed = typeof (argv.default ?? argv.ts ?? argv.jsx ?? argv
.router ?? argv.pinia ?? argv.tests ?? argv.vitest ?? argv.cypress ?? argv.eslin
t) === "boolean";
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js
:60:12)
at internal/main/run_main_module.js:17:47
C:\OpenServer\domains\clientpart>npm -v
6.14.4
C:\OpenServer\domains\clientpart>npm init vue#latest
npx: installed 1 in 2.887s
C:\Users\1\AppData\Roaming\npm-cache\_npx\10624\node_modules\create-vue\outfile.
cjs:3856
const isFeatureFlagsUsed = typeof (argv.default ?? argv.ts ?? argv.jsx ?? argv
.router ?? argv.pinia ?? argv.tests ?? argv.vitest ?? argv.cypress ?? argv.eslin
t) === "boolean";
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js
:60:12)
at internal/main/run_main_module.js:17:47
C:\OpenServer\domains\clientpart>
Tell me how to fix the error and achieve the correct installation of vue.
This error happens because you are using a version of node.js other than 16. You can check the version using the command node --version. I recommend using NVM to manage your node.js versions

Error: Cannot find module '/home/kali/Downloads/Discord-Presser-Server-Nuker-master/index.js'. Please verify that the package.json has a valid "main"

node:internal/modules/cjs/loader:361
throw err;
^
Error: Cannot find module '/home/kali/Downloads/Discord-Presser-Server-Nuker-master/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:353:19)
at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
at resolveMainPath (node:internal/modules/run_main:19:25)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:71:24)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
path: '/home/kali/Downloads/Discord-Presser-Server-Nuker-master/package.json',
requestPath: '/home/kali/Downloads/Discord-Presser-Server-Nuker-master'
}
tried multiple ways including deleting the node modules but still no luck at making it work

Being stupid.. Why can't node.js/node find the path? It's an existing path

Error:
Error: Cannot find module 'PATH'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
If I am guessing correctly though, You are trying to reference PATH from another file, probably your entry file and it can't find PATH. Try one or all of the following:
If PATH is a directory, Use dirname to point to the directory corretly
e.g const Path = path.join(__dirname, '../templates/path')
If PATH is a file you are trying to reference, make sure the last line in PATH.js is module.exports = path then use const PATH = require('./path/to/file') to reference it

How to use a global nodejs module?

I got the following error when I try to use esprima. Does anybody know how to fix the problem? Thanks.
$ npm install -g esprima
/usr/local/bin/esparse -> /usr/local/lib/node_modules/esprima/bin/esparse.js
/usr/local/bin/esvalidate -> /usr/local/lib/node_modules/esprima/bin/esvalidate.js
+ esprima#4.0.1
updated 1 package in 0.837s
$ cat main.js
#!/usr/bin/env node
// vim: set noexpandtab tabstop=2:
var esprima = require('esprima');
var program = 'const answer = 42';
console.log(esprima.tokenize(program));
console.log(esprima.parseScript(program));
$ node main.js
internal/modules/cjs/loader.js:960
throw err;
^
Error: Cannot find module 'esprima'
Require stack:
- /private/tmp/main.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/private/tmp/main.js:4:15)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/private/tmp/main.js' ]
}
I think you installed esprima module in global node_modules.
If you want to use esprima in main.js which is located at /private/temp/main.js,
you should run npm install esprima in /private/temp/ without -g
EDIT - How to require global modules
Way 1
I assume you're in mac system.
Before you run your main.js, run export NODE_PATH=/usr/local/lib/node_modules in the shell, not node.js program.
Then you could require the global modules by const esprima = require("esprima").
By the way, global modules position could be different in the different system.
Way 2
After you knew your global modules position,
you could require it by const esprima = require("/usr/local/lib/node_modules/esprima")

installing with NPM gives out error:2406C06E:random number generator

I'm using Ubuntu server 18.04.
Every time I try to use NPM it crashes and shows the following exception:
internal/crypto/random.js:119
if (ex) throw ex;
^
Error: error:2406C06E:random number generator:RAND_DRBG_instantiate:error retrieving entropy
at Object.randomBytes (internal/crypto/random.js:54:31)
at /usr/lib/node_modules/npm/lib/npm.js:444:32
at Object.<anonymous> (/usr/lib/node_modules/npm/lib/npm.js:496:3)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at /usr/lib/node_modules/npm/bin/npm-cli.js:28:13 {
opensslErrorStack: [
'error:2406B072:random number generator:RAND_DRBG_generate:in error state',
'error:2406C06E:random number generator:RAND_DRBG_instantiate:error retrieving entropy',
'error:2406B072:random number generator:RAND_DRBG_generate:in error state',
'error:2406C06E:random number generator:RAND_DRBG_instantiate:error retrieving entropy'
]
}
Does anybody has any idea of what could be wrong?

Resources