NPM express package not working


#1

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?


#2

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?


#3

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


#4

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


#5

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


#6

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


#7

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?


#8

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


#9

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


#10

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


#11

Chatted with @NathIsEmortal, problem solved :slight_smile:


#12

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


#13

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.


#14

I’m having this same problem now


#15

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.