yeoman / generator-webapp

A gulp.js generator for modern webapps
3.77k stars 708 forks source link

yo webapp not working in node 4.4.7 #610

Closed palerdot closed 7 years ago

palerdot commented 7 years ago

I'm getting following error.

node version - 4.4.7 os - ubuntu 14.04

/usr/local/lib/node_modules/generator-webapp/node_modules/chalk/node_modules/strip-ansi/index.js:2
var ansiRegex = require('ansi-regex')();
                                     ^

TypeError: require(...) is not a function
neilhem commented 7 years ago

Hi, have you tried to remove node_modules and install again?

palerdot commented 7 years ago

@neilhem I'm trying to install in a new directory. Should I remove node_modules globally somewhere for this to work?

I experienced a similar issue with react-boilerplate and filed an issue here. https://github.com/mxstbr/react-boilerplate/issues/1052 sharing, in case it is related.

I will not be able to upgrade node 4.x for local dev reasons. Will there be a problem in using this generator in node 4.x version?

silvenon commented 7 years ago

It should work on 4.4.7, I tried it myself.

  1. make sure you have latest version of npm and yo installed:
    npm install --global npm
    npm install --global yo
    npm --version # should be 4.0.5
    yo --version # should be 1.8.5
  2. run yo doctor to check if there are any other problematic details about your environment, then
  3. try running yo webapp again.
palerdot commented 7 years ago

I have all the mentioned versions installed but still I'm getting the same error mentioned at the start of the issue.

My yo doctor also runs fine.

But, I tried uninstalling 'generator-webapp' and reinstalling again, and following is the weird error message I get. I'm not sure what it means, since my output for yo --version gives 1.8.5

generator-webapp@2.3.2 requires a peer of yo@>=1.7.1 but none was installed.
silvenon commented 7 years ago

Don't worry about that message, it's a known npm issue, that's a false warning.

So after reinstalling generator-webapp yo webapp still doesn't work?

I can't reproduce this, in my case require('ansi-regex')() is indeed a function. The only version of ansi-regex where it wasn't a function is v0.1.0, maybe that one got installed in your case. Try digging up in your global node_modules (check ansi-regex/index.js), hopefully you'll get a clue what happened.

I don't think this is an issue with this generator, but something specific to your environment, so I'm closing this.