6

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)
Steve Birkner
  • 63
  • 1
  • 3
  • is the path to "./lexer" correct? could you please post the code for module.js or your app/server file? –  Jul 08 '14 at 18:55
  • 1
    @Rockyy I just had to follow this http://stackoverflow.com/questions/13011290/cannot-find-module-coffee-script/19023184#19023184 just deleting the node_modules folder and npm install in that directory fixed the issue. – Steve Birkner Jul 08 '14 at 19:05

2 Answers2

6

As @SteveBirkner already mentioned, delete the node_modules directory and run npm install command again. It should work.

xpepermint
  • 35,055
  • 30
  • 109
  • 163
  • This is not working for me!! Any other solution? I tried everything on found already! event grunt -v gives me the same error – mohi Apr 07 '15 at 21:57
2

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.

mohi
  • 1,093
  • 2
  • 16
  • 21