Node.JS: Cannot find module './abort.js' - javascript

I'm using node.js v17.3.0 and im trying to upload my Discord bot to my raspberry pi. On my local PC it works, but on my raspi i get this error:
Anyone has a solution for that?
[Bot-Handler] Starting Bot...
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './abort.js'
Require stack:
- /home/excerz/node_modules/combined-stream/lib/combined_stream.js
- /home/excerz/node_modules/form-data/lib/form_data.js
- /home/excerz/node_modules/discord.js/src/rest/APIRequest.js
- /home/excerz/node_modules/discord.js/src/rest/RESTManager.js
- /home/excerz/node_modules/discord.js/src/client/BaseClient.js
- /home/excerz/node_modules/discord.js/src/index.js
- /home/excerz/main.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:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/excerz/node_modules/combined-stream/lib/combined_stream.js:1:13)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/excerz/node_modules/combined-stream/lib/combined_stream.js',
'/home/excerz/node_modules/form-data/lib/form_data.js',
'/home/excerz/node_modules/discord.js/src/rest/APIRequest.js',
'/home/excerz/node_modules/discord.js/src/rest/RESTManager.js',
'/home/excerz/node_modules/discord.js/src/client/BaseClient.js',
'/home/excerz/node_modules/discord.js/src/index.js',
'/home/excerz/main.js'
]
}
Node.js v17.3.0```

Related

Can't find module "semver" on node.js / code: 'MODULE_NOT_FOUND',

I'm having trouble running a project. He always falls into this error. What can it be?
node:internal/modules/cjs/loader:956
const err = new Error(message);
^
Error: Cannot find module 'semver'
Require stack:
- /usr/share/nodejs/npm/lib/utils/unsupported.js
- /usr/share/nodejs/npm/lib/cli.js
- /usr/share/nodejs/npm/bin/npm-cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/usr/share/nodejs/npm/lib/utils/unsupported.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/share/nodejs/npm/lib/utils/unsupported.js',
'/usr/share/nodejs/npm/lib/cli.js',
'/usr/share/nodejs/npm/bin/npm-cli.js'
]
}
I have already reinstalled and installed npm several times. I cleared cache and everything and nothing!

an error occurred node js connect mongodb

node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './logic/products'
Require stack:
E:\wz\route\products.js
E:\wz\app.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. (E:\wz\route\products.js:3:54)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157: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: [ 'E:\wz\route\products.js', 'E:\wz\app.js' ]
}
E:\wz> node app.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './logic/products'
Require stack:
E:\wz\route\products.js
E:\wz\app.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. (E:\wz\route\products.js:3:21)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157: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: [ 'E:\wz\route\products.js', 'E:\wz\app.js' ]
}

Cannot find module

internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'better-sqlite3'
Require stack:
- D:\UserProfile\Users\Administrator\Desktop\rosbot\src\utils\db.js
- D:\UserProfile\Users\Administrator\Desktop\rosbot\src\Client.js
- D:\UserProfile\Users\Administrator\Desktop\rosbot\app.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\rosbot\src\utils\db.js:1:18)
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: [
'D:\\UserProfile\\Users\\Administrator\\Desktop\\rosbot\\src\\utils\\db.js',
'D:\\UserProfile\\Users\\Administrator\\Desktop\\rosbot\\src\\Client.js',
'D:\\UserProfile\\Users\\Administrator\\Desktop\\rosbot\\app.js'
]
}
I am getting this error when I am trying to run the discord bot with vscode by the command "node ." and I don't know how to solve this
Looks like you haven't Imported the module or named it wrong or installed
example to fix importing error:
const <name> = require("better-sqlite3");
example to fix name error:
const <name> = require("better-sqlite3");
example to fix installing error:
in cmd type: npm i better-sqlite3
after that type
const <name> = require("better-sqlite3")
change name with what you want it to be as.

Keep getting this error Error: Cannot find module './config.json'

Here is the error that I get every time I try to execute the code and I can't find a solution so please help.
PS C:\Users\boble\OneDrive\Desktop\ScriptsNStuff\karmik> node .
node:internal/modules/cjs/loader:927
throw err;
^
Error: Cannot find module './config.json'
Require stack:
- C:\Users\boble\OneDrive\Desktop\ScriptsNStuff\karmik\commands\Test.js
- C:\Users\boble\OneDrive\Desktop\ScriptsNStuff\karmik\index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\boble\OneDrive\Desktop\ScriptsNStuff\karmik\commands\Test.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\boble\\OneDrive\\Desktop\\ScriptsNStuff\\karmik\\commands\\Test.js',
'C:\\Users\\boble\\OneDrive\\Desktop\\ScriptsNStuff\\karmik\\index.js'

Error: Cannot find module '#rails/webpacker' rails 6

When I run my Rails 6.0 application on development environment I get the next trace on the development.log
[Webpacker] Compiling…
[Webpacker] Compilation failed:
/home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js:93
throw err;
^
Error: Cannot find module '#rails/webpacker'
Require stack:
- /mnt/config/webpack/environment.js
- /mnt/config/webpack/development.js
- /home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js
- /home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js
- /home/alejo/rails_project/node_modules/webpack/bin/webpack.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:954:17)
at Function.Module._load (internal/modules/cjs/loader.js:847:27)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/mnt/config/webpack/environment.js:1:87)
at Module._compile (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/mnt/config/webpack/development.js:3:21)
at Module._compile (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at WEBPACK_OPTIONS (/home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13)
at requireConfig (/home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6)
at /home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17
at Array.forEach (<anonymous>)
at module.exports (/home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15)
at /home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js:71:45
at Object.parse (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/yargs/yargs.js:567:18)
at /home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js:49:8
at Object.<anonymous> (/home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js:366:3)
at Module._compile (internal/modules/cjs/loader.js:1121:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/mnt/config/webpack/environment.js',
'/mnt/config/webpack/development.js',
'/home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js',
'/home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js',
'/home/alejo/rails_project/node_modules/webpack/bin/webpack.js'
]
}
I am using webpacker 4.0.7, rails 6.0.0 and ruby 2.6.5
I want to know why am I getting this error and how do I solve it.
Thank you
I ran into this issue as well. For me, the issue was the node version (13.6.0). I figured this out by running yarn add #rails/webpacker, which returned the error Expected version "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7". Got "13.6.0"
To fix it:
Update node to an appropriate version (see error above)
Delete node_modules directory
Update yarn files with yarn install --check-files
Install webpacker with rails webpacker:install
Confirm it worked by bin/webpack-dev-server and getting no errors

Categories

Resources