cgross / generator-cg-angular15

Yeoman Generator for Enterprise Angular 1.5 Projects with Typescript, Webpack, and Sass.
MIT License
33 stars 3 forks source link

error when running generator #5

Closed rbosneag closed 7 years ago

rbosneag commented 7 years ago

After installing the dependencies with npm install -g yo karma webpack webpack-dev-server typings generator-cg-angular15 and running yo I keep getting this error:

readline.js:982
            throw err;
            ^

Error: Cannot find module 'ansi-regex'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/generator-cg-angular15/node_modules/yeoman-generator/node_modules/chalk/node_modules/strip-ansi/index.js:2:38)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

I have already updated node, npm, yo and did some investigation work but with no success so far.

rbosneag commented 7 years ago

Obviously, it had nothing to do with the generator itself. It was a problem with the global npm packages that were migrated from another version of node which was installed under nvm but the cg-angular15 generator was run out of nvm scope.

Basically, a npm cleanup will solve issues like this, ie: npm cache clean, rm -rf /paths-to-npm/node-modules and checking whether there still are npm packages installed on the system (looking also in /usr/local..., ~/.nvm/..., etc)