Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
84
rated 0 times [  85] [ 1]  / answers: 1 / hits: 12000  / 9 Years ago, sat, june 6, 2015, 12:00:00

I am running a JavaScript code on Ubuntu server using node.js
I got this error.



module.js:340
throw err;
^
Error: Cannot find module './lib/compat'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/nodejs/node_modules/express/node_modules/depd/index.js:11:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)


How to debug this error?



Edit: using these dependencies.



var express = require('express');
var fs = require('fs');
var request = require('request');
var cheerio = require('cheerio');

More From » node.js

 Answers
2

The problem is not directly in your code, but in the dependency of one of the modules you're using. You see it at this line of the error message:



    at Object.<anonymous> (/usr/lib/nodejs/node_modules/express/node_modules/depd/index.js:11:24)


express module has a dependency called depd, which is the module in trouble.



How did you install your modules?



There has probably been some problem when you have installed express.



The folder lib/compat is directly part of depd, so there's no reason it should be missing.



You may want to do the following:



npm uninstall express
npm install express --save


This would reinstall express, hopefully solving the issue.


[#36560] Friday, June 5, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ariel

Total Points: 523
Total Questions: 111
Total Answers: 100

Location: Anguilla
Member since Sun, Jan 29, 2023
1 Year ago
;