Henrique Liberato Henrique Liberato - 5 months ago 57
Node.js Question

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 :)

Answer

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
Comments