yeoman angular generator wont start on grunt serve - node.js

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.

Related

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.

Error: Cannot find module 'indexof' in 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.

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)

Cannot run express-spdy app using NodeJS

I'm not able to run NodeJS Express-Spdy examples downloaded from GitHub.
I'm getting the below error:
C:\Program Files\nodejs\node_modules\npm\node_modules\express-spdy>node app.js
module.js:340
throw err;
^
Error: Cannot find module 'express-spdy'
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:\Program Files\nodejs\node_modules\npm\node_modules\express- spdy\app.js:6: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 Function.Module.runMain (module.js:497:10)
Please tell me how to resolve this error, as I have put express-spdy inside node_modules folder.
When I run the example using SPDY module only by placing it inside node_modules it works fine but with express-spdy module it shows above error.

Resources