develop1 develop1 - 1 month ago 13
Node.js Question

Error: Cannot find module './algs'

When trying to run a nodejs server I keep getting this error for a missing module './algs'. Does anyone know which module I need to install to get this to work?

Error :

$ node index
module.js:457
throw err;
^

Error: Cannot find module './algs'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:<file path>\node_modules\sshpk\lib\key.js:6:12)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)


Package.json :

{
"name": "Stock",
"version": "0.2.5",
"description": "Stock website",
"engines": {
"node": "5.9.1"
},
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"body-parser": "^1.15.2",
"ejs": "2.4.1",
"express": "4.13.3",
"firebase": "^3.5.2",
"jquery": "^3.1.1",
"multer": "^1.2.0",
"watson-developer-cloud": "^2.8.1"
},
"repository": {
"type": "git",
"url": "<git url>"
},
"keywords": [
"node",
"heroku",
"express"
],
"license": "MIT"
}


I have tried
npm install algs
and
./algs
but it does not work.

Answer

I am not sure but I don't think it's about algs module or if there any module called algs.

A similar thing happened to me today. I was using event-stream with gulp and trying to concat two streams. While running the code, I saw some random module error like yours and the funny thing is I didn't even use that random module in my code. Then I looked closely and found that I am missing a comma in between two streams. I guess the module which shown missing by the error, was a dependency for event-stream (module that I have used).

I am not saying you maid mistake like me but taking a close look may help you.