NPM express package not working

I was just about to continue coding when logs said there was an error. It was saying to me:

Error: Cannot find module ‘express’

(Full error):

Error Message

module.js:540
throw err;
^

Error: Cannot find module ‘express’
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. (/app/novus.js:2:17)
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)

Here is my package.json:

package.json

{
“name”: “quantum-novus”,
“version”: “2.0.0”,
“description”: “quantum novus”,
“main”: “novus.js”,
“scripts”: {
“start”: “node novus.js”
},
“engines”: {
“node”: “8.9.4”
},
“author”: “NathIsEmortal”,
“license”: “ISC”,
“dependencies”: {
“discord.js”: “^11.3.0”,
“request”: “^2.83.0”,
“isgd”: “^1.3.3”,
“express”: “^4.16.2”
}
}

Am I doing anything wrong? If so, what?

Problem seems to have been solved. Apparently Glitch was experiencing problems with PNPM (NPM that takes up less space) if your project is still having this problem do what etaponi said in the comments.

Hi @NathIsEmortal,

sorry about it! We are doing some experiments with a new package manager and you got a weird bug :slight_smile:

I think I fixed your issue, is that right?

Yes that has fixed the issue. I hope your new package manager goes well! Thanks for the help.

It has broken again :confused: what can I do to fix it?

Very strange! Same project? Can you DM me a join link?

Sorry, but how do I direct message i am new to the support section of glitch? Also it is the same project

Do not worry about the PM, you can do this: open the console (Project Menu -> Advanced Option -> Open Console) and then run enable-npm.

It should work. Did you remove the node_modules folder in the last few minutes?

Yes that seems to work for now. It seems to error when a new package is added, because i just added another package.

So if you add a new package, it fails again?

That is what i thinks is happening, but it only happens on express and express isnt at the top of package.json.

Chatted with @NathIsEmortal, problem solved :slight_smile:

I seem to be having this problem after doing the console commands mentioned in ERROR: Your project is out of disk space.

I haven’t been able to reproduce following the same steps, so it could be specific to your setup - please share your project that has this issue.

I’m having this same problem now

There are a few possible causes. Check your project isn’t out of space - run df and look at the disk space usage for /app. Failing that, problems with other dependencies can cause it too - so look for 404s or other errors. If you’re still having problems, let us know the project name and we’ll take a look. If your project is private, either make it public temporarily or DM me a join link so we can view the code. Thanks.

Project Name : clienthub , please help.

I’m getting this issue in the project ‘hhbot’. Running npm i in console gives a no access error to @types

Hey @DotGamer that looks like an installation problem. Please try running enable-pnpm in the console and let us know how you get on.

P Name : clienthub
I tried to do that , unfortunately didn’t do a thing.
I tried in the full console page and in the editor page in logs itself.
Both attempts worked per se , but the error hasn’t changed , it can’t find module : ‘express’.

Ah, I see the problem! If you look closely at the error messages after running enable-pnpm you’ll see that the installation is running into problems installing the version of http you’re requesting:

node v8.15.1, with pnpm

Installing...

 ERROR  No matching version found for http@>=0.0.1 <0.0.2

In fact, both http and fs are built into Node, so you don’t need to put them in your package.json file or install them separately. When pnpm runs into that problem it stops trying to install and therefore never installs Express, which is why your code can’t find it.

If you remove those lines from your package.json file I think you’ll have better luck.