Yeoman angular generator error

2k Views Asked by At

When I'm using the angular yeoman generator, I'm getting the following error:

module.js:340
    throw err;
    ^
Error: Cannot find module './lib/pack.js'
    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\kra\AppData\Roaming\npm\node_modules\generator-karma\node_modules\yeoman-generator\n
ode_modules\download\node_modules\decompress\node_modules\decompress-tarbz2\node_modules\tar\tar.js:171:16)
    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 idea why?
npm version 1.4.28
node version 0.10.33
yeoman version 1.3.3

2

There are 2 best solutions below

2
On

Try remove your generator-karma and generator-angular, run npm cache clean, and install them again

0
On

I just had a similar issue, this might not be the solution but your version of npm is out of date, try typing:

sudo npm install npm -g

As referenced On the npm website (note they use sudo in the example but it might not be necessary). after that:

npm --version 

Is currently 2.1.12 so it should be higher than that.

You can then try:

npm update

to upgrade everything to the latest version (See this page).

This may solve the problem.