mendixlabs / generator-mendix

Yeoman generator for Mendix widgets
MIT License
17 stars 15 forks source link

Error when generating widget #21

Closed Marnix-IxD closed 6 years ago

Marnix-IxD commented 7 years ago

I'm using the Webstorm Javascript development environment, with my node / yeoman setup I get the following error when generating the widget, does anyone have an idea how to fix this?

  __  ____   __           _     _            _    
 |  \/  \ \ / /          (_)   | |          | |   
 | \  / |\ V /  __      ___  __| | __ _  ___| |_  
 | |\/| | > <   \ \ /\ / / |/ _` |/ _` |/ _ \ __| 
 | |  | |/ . \   \ V  V /| | (_| | (_| |  __/ |_  
 |_|  |_/_/ \_\   \_/\_/ |_|\__,_|\__, |\___|\__| 
                                   __/ |          
                                  |___/           
 Generator, version: 2.0.1
 Issues? Please report them at : https://github.com/mendix/generator-mendix/issues

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

TypeError: this.env.adapter.prompt(...).then is not a function
    at constructor.Base.prompt (C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\node_modules\yeoman-generator\lib\base.js:240:45)
    at constructor.prompting (C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\generators\app\index.js:93:10)
    at Object.<anonymous> (C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\node_modules\yeoman-generator\lib\base.js:439:23)
    at C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\node_modules\run-async\index.js:26:25
    at C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\node_modules\run-async\index.js:25:19
    at C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\node_modules\yeoman-generator\lib\base.js:440:9
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
JelteMX commented 7 years ago

What is the version of Yeoman you are running? (yo version)

I'm running 1.8.5 and it works:

$ yo --version
1.8.5
Marnix-IxD commented 7 years ago

Node version is v6.9.1 Yo version is 1.8.5.

JelteMX commented 7 years ago

You are running this from Webstorm or the command-line? It's weird. I have the same setup (node 6.9.1 and yo 1.8.5) and it works in my console.

Marnix-IxD commented 7 years ago

I'm running it from the Webstorm start new project > Yeoman > Select the Mendix generator > click next and then it gives that error.

Marnix-IxD commented 7 years ago

If i use it from the .cmd or terminal inside webstorm (which is .cmd) in an empty folder it works. but I expected it to generate properly as well when directly using it from the yeoman generator selection

JelteMX commented 7 years ago

Can you please explain in steps how you use the 'yeoman generator selection'? Is this a plugin in WebStorm? If so, that might explain the problem, as in that it cannot answer any questions. Which would be a problem with Webstorm, instead of Yeoman.

Marnix-IxD commented 7 years ago

step1-projectchoice step2-selectgenerator

Marnix-IxD commented 7 years ago

Basically you select a project type, and then it allows for using installed generators.

JelteMX commented 7 years ago

I checked the issue and it seems that this is purely related to Webstorm and the way it interacts with the generator. Right now I can't fixed it, but I am investigating. Other generators also use the prompt and work in Webstorm, so there might be something I am missing right now.

The only thing I can see is that Webstorm doesn't accept adapter.prompt as a Promise. Other generators favor an callback style (which I don't). I'll see if I can rewrite this, using a callback (previous attempts failed)

JelteMX commented 6 years ago

This seems to be fixed in newer versions of WebStorm. Closing