Bot error on installing packages

Error: Cannot find module ‘express’

I have the express package, but it will still make this error in the console for no reason

Another error is
ERROR No matching version found for node.js@>=0.0.0 <0.0.1

Your top question can usually be fixed by running enable-pnpm in console.

Could you show us your package.json file?

enable-pnpm didnt work,
packages:

{
“//1”: “describes your app and its dependencies”,
“//2”: “https://docs.npmjs.com/files/package.json”,
“//3”: “updating this file will download and update your packages”,
“name”: “hello-sqlite”,
“version”: “0.0.1”,
“description”: “A simple Node app with SQLite as a database management system, instantly up and running.”,
“main”: “server.js”,
“scripts”: {
“start”: “node server.js”
},
“dependencies”: {
“express”: “^4.17.1”,
“sqlite3”: “^4.1.1”,
“quick.db”: “^6.3.2”,
“discord.js”: “^12.1.1”,
“ms”: “^2.1.2”,
“fortnite”: “^4.3.2”,
“fortnite-api”: “^3.4.0”,
“fs”: “^0.0.2”,
“ytdl-core”: “^1.0.3”,
“body-parser”: “^1.19.0”,
“canvas”: “^2.6.1”,
“superagent”: “^5.1.2”,
“mathjs”: “^6.2.5”,
“moment”: “^2.24.0”,
“common-tags”: “^1.8.0”,
“simple-fortnite-api”: “^0.1.8”,
“node-opus”: “^0.3.2”,
“collections”: “^5.1.8”,
“overwatch-api”: “^0.8.1”,
“weather-js”: “^2.0.0”,
“erela.js”: “^1.0.4”,
“node.js”: “^0.0.0”,
“lavalink”: “^2.8.1”,
“better-discord-antispam”: “^1.0.6”
},
“engines”: {
“node”: “8.x”
},
“repository”: {
“url”: “https://glitch.com/edit/#!/hello-sqlite
},
“license”: “MIT”,
“keywords”: [
“node”,
“glitch”,
“express”
]
}

i copied those from my old bot, which has the same commands

Try this: npm i express -g. Or try to change the node version to 12.x as that is the latest version. May that not work. Try node version 10.x

But start at the beginning with installing express globally :wink:

not working what should i do ?

its because its a new project on the other one it worked

Anyone online can help please

I see you want your issues to be resolved. But I have had this as well. There is just something wrong in your code. Someone will get to you as soon as they can. Don’t rush them because then you’ll get the same like me: Being hated.

And that is no good feeling…

Glitch is a Free hosting service and everyone does this at their spare time.

I know,
Listen, I have my other bot’s project, which is the same one.
I don’t see why this one won’t work, and if im not wrong it happens every time I open a new project.

Try npm uninstall express and then npm i express

Sometimes Glitch just doesn’t do it correctly. Can happen.

Didn’t work
need 20 char

Is there any other kind of host that i can host my discord.js bot’s code on?

Try to rebuild your package.json. I though it was something like npm rebuild. But you’ll have to remove your package.json first.

Do i need to remove it all and start over? because i tried and it didnt work

Not for free… There are some hosts but they mostly require a monthly payment.

So fast? That is impossible. Yes. Delete your package.json and then try npm rebuild

I tried before thats the thing

Delete the whole thing? package.json file?

Then I don’t have any solutions no more. I’ll try to ping @cori as he mostly knows…

Yes. And then run npm rebuild

It says its an unknown command

Command not found

Hold on. I know it is something with rebuild…

I looked it up on google, maybe npm build?

Try this one: npm-rebuild

The npm rebuild now worked, i created a new file called package.json (because i deleted the other one)

Okay, but in fact npm-rebuild makes a package.json for you…

I will try it right now

You now only have to re-install all your packages and hope for it to work.

I tried and the command aren’t working idk what to do

Define what is not working.

I tried npm rebuild after i pasted the file again, nothing happend

You did npm-rebuild once you have deleted the package.json?

Command not found
i just tried again

Are you sure you are not forgetting the stripe…

npm-rebuild is what i did after deleting the package.json file

npm-rebuild is the full command.

Hmmm… Okay… Hold on a moment.

I have been told to use this one npm rebuild

I get confused sometimes of people telling me it is with the stripe, and people telling me it is without the stripe…

I just deleted the package.json again and tried the npm rebuild command, command not found…

How weird. So neither npm-rebuild as npm rebuild have been found? Have you already tried using pnpm-rebuild and pnpm rebuild?

Just got confirmation. It is npm-rebuild. That is the correct command.

Also, it is 1:45 Am…

2:45 here D:::::::::

Damn. Okay. You’re 1 hour in front of me. Nice :slight_smile:

What should i try then?

What I have been told, npm-rebuild must be the correct command.

Do i need the file to exist? empty? deleted?

I tried it without the file, with the file empty, with the file and the packages in, unknown command

Okay. This is what you gonna do. Just run npm-rebuild. It will overwrite the file.

Do i need the package.json file to be deleted or just be empty or somthing?

Leave the file like it is now.

i deleted the package.json

If it is not npm-rebuild it might be pnpm-rebuild

I didn’t said to delete it… Anyhow, just run the commands I have recently told you about.

Oh i thought you meant to delete, anyway, should i just put the file and the packages back again and try?

I got the file and all the packages again but both pnpm-rebuild and npm-rebuild didnt work

My friend thinks so…

I have no idea what to do now

I am out of options. Deleting all packages and reinstalling them didn’t worked?

Didnt work

And what about doing rm rf /node_modules

And then do ls and tell me the output.

And for final confirmation. My friend just checked and it is npm rebuild and if isn’t that command, then you’re wasting my time. That is what my have been told…

He even tested it. Run this in your console.

Hey
i just tried deleting all packages and reinstalling (pretty sure i tried already)
and its now just working
im gonna install them all and then come back

Okay. Good luck. I’ll be waiting.

Try using sudo rm -rf. My friend says it will delete everything.

Make sure you have your commands saved :wink:

/rbd/pnpm-volume/10f3377a-9920-4a94-bcd9-a4ea92ab01c2/node_modules/.registry.npmjs.org/discord.js/12.1.1/node_modules/discord.js/src/client/Client.js:41

3:03 AM

} catch {

3:03 AM

i once fixed that problem with rewinding to before package update

It requires node 12.x

Discord.js v12 requires node 12.x

couldnt find express, again.

“engines”: {
“node”: “12.x”

Well, I think express is then not ready for node v12 yet… I am not sure. It should be… Try changing node version to 10.x and discord.js to 11.6.3

You probably have to change all your code again. But it will be worth it.

not working
thanks anyway
i will try to wait untill tommorow to see if its fixed somehow
or open a new glitch account i really dont know

Okay. Glad I could help you. May you have any other questions, be free to join my Discord Server about learning to code: https://discord.gg/QmFDq43

I remixed my old project and changed some stuff and it worked

Glad it worked :slight_smile: Have a nice day.

Don’t forget to mark this topic as solved :wink:

the problem is back
help someone

Hi @itay949494994, So the issue is it errors when requiring Express saying it is not found? That would mean the package is not installed and can be done with “pnpm i express” in the Terminal, if pnpm is not found run enable-pnpm

Also @anon7375287 I have express running on 12.x it works fine.

It wont work, its installed already

Is there an error message?

actually, i tried and it worked, but i have to install all of the packages with the pnpm i command, is there a way to install them all ?

installed a few and its now working, probably needed an update so i did pnpm i packagename.
thanks,

pnpm update would update all packages listed in package.json., Or you could run pnpm install to get the versions listed

Can you try deleting your package.json and use npm init?

Change the dependency on your package.json.
The node is supposed to be 12.16.1 not 0.0.0.
Then do

npm install [email protected]