Error: Cannot find module 'indexof' in node.js - node.js

I am trying to use nodejs for a application, i am continuously getting the
error: Cannot find module.
module.js:340
throw err;
^
Error: Cannot find module 'emitter'
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> (/home/nilesh/node/node-v0.10.32/prgm/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/index.js:9:15)
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)
i tried installing one, but the other comes up, and this is continuous. Is there something which can be done to this, i tried doing this
npm install -g emitter,
it prints the path where it is present but it is not solving the issue.What could be the solution to this.
Thanks,

You probably want:
var Emitter = require('events').EventEmitter in your code
or
npm install emitter from the commandline.
I don't know why you're trying to install indexof, the error is about emitter.

Related

Cannot find module "gulp-nodemon". On windows 7, 32 bit. Using Power Shell

I am new to Node.js. I am trying to learn it through doing something.
I am making an Sentiment Analysis App for twitter.
I am using Gulp.
However, whenever I use "gulp" in my cmd. Note that I have installed Nodemon.
I get the following error :
Error: Cannot find module 'gulp-nodemon'
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> (C:\Users\home\desktop\sentimentAnalysisApp\Gulpfile.js:4:13)
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)
Also, I am following this [tutorial].
http://www.sitepoint.com/creating-sentiment-analysis-application-using-node-js/
Thank you.
You need to install gulp-nodemon as well.
Try npm install -g gulp-nodemon.

Yeoman, ran yo webapp, grunt throwing error

I ran 'yo webapp' and am now trying to run grunt serve and get the error that is below. Has anyone seen this error before?
grunt serve
module.js:340
throw err;
^
Error: Cannot find module 'findup-sync'
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> (/Users/william/wdi/pixelect_project/pixelect_client_server/node_modules/grunt/lib/grunt/file.js:24:15)
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)
You are probably forgetting about installing the dependencies. Try to install the dependencies using bower before running grunt.
Try to run this:bower install.

yeoman angular generator wont start on grunt serve

When I set up the angular generator with yeoman I get this error after doing grunt serve
module.js:340
throw err;
^
Error: Cannot find module './lexer'
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> (/var/www/angMaps/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/coffee-script.js:10:10)
at Object.<anonymous> (/var/www/angMaps/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/coffee-script.js:167:4)
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)
As #SteveBirkner already mentioned, delete the node_modules directory and run npm install command again. It should work.
I had the same problem, and in the end of the log I was receiving such a message:
...
http 200 http://registry.npmjs.org/-/all
Killed
The problem was the lack of enough memory in my VM. One solution was to use swap is mentioned here.

Error: cannot find module './lib/middleware'

I am attempting to run the demo for the mobwrite node.js package. First I installed the mobwrite package (npm install mobwrite) and then entered the following command:
node -e "require('mobwrite').quickserve()"
A demo server should start, but the following error is thrown:
module.js:340
throw err;
^
Error: Cannot find module './lib/middleware'
at Function.Module._resolveFilename (module.js:388: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> (PATH_TO_MODULES\mobwrite.js:2:18)
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)
at require (module.js:380:17)
at [eval]:1:1
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compie (module.js:456:26)
at evalScript (node.js:532:25)
at startup (node.js:80:7)
at node.js:901:3
This originates from the mobwrite.js file, in which the package needs to include a middleware file (middleware.coffee) which is stored in a lib folder:
require("coffee-script")
middleware = require("./lib/middleware")
module.exports = middleware
I have looked at the answers to similar posts on SO, but nothing has solved my problem so far. How can I overcome this error?
You could try manually compiling the coffeescript files to javascript: npm install -g coffee-script && coffee -c node_modules/mobwrite/lib/middleware.coffee && coffee -c node_modules/mobwrite/lib/daemon.coffee. Then retry your command.

Node throwing an error on ansi module

I'm looking to check out Mike Bostock's Rivers, but I'm running into an error with Node.js. npm install gives me:
module.js:340
throw err;
^
Error: Cannot find module 'ansi'
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/local/Cellar/node/0.10.0/lib/node_modules/npm/node_modules/npmlog/log.js:5:12)
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)
Any pointers? Or, any previous questions I missed that might point to a solution?
If you run on RH CentOS of Fedore reinstall
yum reinstall nodejs-ansi.noarch
This fixed my similar issue
You can run:
npm install ansi -g
to make ansi available globally (you may have to use sudo)

Resources