Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "Unhandled 'error' event" after running yo generator

I am trying to use the generator of generatos, the generator-generator, and I am facing an error.

henrique@liberato:~/Documents$ yo generator
? Your generator name (generator-documents) 

events.js:154
      throw er; // Unhandled 'error' event
      ^

TypeError: this.env.adapter.prompt(...).then is not a function
    at Base.prompt (/home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/yeoman-generator/lib/base.js:232:45)
    at askName (/home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/inquirer-npm-name/lib/index.js:25:19)
    at module.exports.generators.Base.extend.prompting (/home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/app/index.js:21:12)
    at Object.<anonymous> (/home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/yeoman-generator/lib/base.js:431:23)
    at /home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/run-async/index.js:26:25
    at /home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/run-async/index.js:25:19
    at /home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/yeoman-generator/lib/base.js:432:9
    at processImmediate [as _immediateCallback] (timers.js:383:17)

Versions:

henrique@liberato:~/Documents$ node -v
v5.8.0
henrique@liberato:~/Documents$ npm -version
3.8.9

I already did npm cache clean and npm install -g yo/yeoman-generator/generator-generator. Already reinstaled node and npm.

Thanks for your time :)

like image 922
Henrique Liberato Avatar asked May 12 '16 17:05

Henrique Liberato


2 Answers

You need to update yo to the latest version.

npm -g update yo

And if that doesn't work, then you want:

npm -g uninstall yo
npm -g install yo
like image 170
Simon Boudrias Avatar answered Oct 21 '22 10:10

Simon Boudrias


I had similar issue. However, updating or re-installing yo didn't help me.

My node environment is managed by nvm, where I am currently using node v6.2.0. However, yo was installed long ago in my pc while I was using node v4.4.1. When I used v4.4.1, I didnt get the error.

So, conclusion is that the yo angular-fullstack commands are working in the same node version in which it was installed. As nvm is handy in switching between node version, its not a big deal for me. I use v4.4.1 only when i generate some angular components, and switch back to the latest version.

like image 43
chank Avatar answered Oct 21 '22 10:10

chank