ericmdantas / generator-ng-fullstack

Client, server or fullstack - it's up to you. ng-fullstack gives you the best of the latest.
MIT License
704 stars 103 forks source link

Can not create server-side endpoint #256

Closed ddesna closed 7 years ago

ddesna commented 7 years ago

I have this error when I trying to create new NodeJS server-side endpoint:

$ yo ng-fullstack:endpoint commons --feature common
events.js:160
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property 'copyFiles' of undefined
    at EndpointSubGenerator.writing (/usr/local/lib/node_modules/generator-ng-fullstack/_ng/server/sub_generators_endpoint.js:42:74)
    at EndpointGenerator.writing (/usr/local/lib/node_modules/generator-ng-fullstack/endpoint/index.js:18:20)
    at /usr/local/lib/node_modules/generator-ng-fullstack/node_modules/yeoman-generator/lib/base.js:421:16
    at runCallback (timers.js:649:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)

Note: client-side Angular components creates without issues. Using generator-ng-fullstack@1.9.5

ericmdantas commented 7 years ago

Hello, @ddesna.

Can you share the content of your .yo-rc.json?

ddesna commented 7 years ago

Hi @ericmdantas,

{
  "generator-ng-fullstack": {
    "username": "ddesna",
    "appName": "myApp",
    "stack": "fullstack",
    "server": "node",
    "client": "ng2",
    "transpilerServer": "node",
    "secure": true,
    "differentStaticServer": false
  }
}
ericmdantas commented 7 years ago

I see.

Can you please add the following line there?

{
// ...
"nodeWebFramework": "express"
// ...
}

And try again? Since there's the options to work with koa now, that's something that's needed in the yo-rc file.

Either way, I'm patching a fix to consider express as the default one. Thanks for the report.

ericmdantas commented 7 years ago

v1.9.6 published with the fix.

ddesna commented 7 years ago

Thanks @ericmdantas, Adding "nodeWebFramework": "express" line, it was still happening but after update to v1.9.6 it's working perfectly.

ericmdantas commented 7 years ago

👍