dustinspecker / generator-ng-poly

Yeoman generator for modular AngularJS apps with Gulp and optional Polymer support
MIT License
237 stars 50 forks source link

yo ng-poly commands all crash when choosing a module #231

Closed d-rep closed 8 years ago

d-rep commented 8 years ago

When I'm using ng-poly to create anything (angular service, view, etc) inside an existing ng-poly project, it asks me to choose a module but doesn't display a list of the modules in my project. When I hit the up or down arrow keys, it crashes.

yo ng-poly:service a
? Which module is this for? (Use arrow keys)
? Which module is this for?

TypeError: Cannot read property 'length' of null
    at ScreenManager.render (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/utils/screen-manager.js:65:52)
    at Prompt.render (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/prompts/list.js:102:15)
    at Prompt._run (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/prompts/list.js:73:8)
    at Prompt.run (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/prompts/base.js:55:8)
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/ui/prompt.js:84:12)
    at module.exports (/usr/local/lib/node_modules/yo/node_modules/run-async/index.js:15:21)
    at AnonymousObservable.__subscribe (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/utils/utils.js:16:7)
    at AnonymousObservable.tryCatcher (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:63:31)
    at setDisposable (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:5741:44)
    at AnonymousObservable.innerSubscribe [as _subscribe] (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:5755:9)
TypeError: Cannot read property 'length' of null
    at ScreenManager.render (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/utils/screen-manager.js:65:52)
    at Prompt.render (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/prompts/list.js:102:15)
    at Prompt._run (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/prompts/list.js:73:8)
    at Prompt.run (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/prompts/base.js:55:8)
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/ui/prompt.js:84:12)
    at module.exports (/usr/local/lib/node_modules/yo/node_modules/run-async/index.js:15:21)
    at AnonymousObservable.__subscribe (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/utils/utils.js:16:7)
    at AnonymousObservable.tryCatcher (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:63:31)
    at setDisposable (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:5741:44)
    at AnonymousObservable.innerSubscribe [as _subscribe] (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:5755:9)
readline.js:924
            throw err;
            ^

TypeError: Cannot read property 'length' of null
    at ScreenManager.render (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/utils/screen-manager.js:65:52)
    at Prompt.render (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/prompts/list.js:102:15)
    at Prompt.onDownKey (/usr/local/lib/node_modules/yo/node_modules/inquirer/lib/prompts/list.js:135:8)
    at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.next (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:1535:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:1469:31)
    at AnonymousObserver.tryCatcher (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:63:31)
    at AutoDetachObserverPrototype.next (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:5782:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:1469:31)
    at AutoDetachObserver.tryCatcher (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:63:31)
    at AutoDetachObserverPrototype.next (/usr/local/lib/node_modules/yo/node_modules/rx-lite/rx.lite.js:5782:51)`

This is generator-ng-poly@0.11.3 and Node v5.0.0 and npm v3.3.9 on a Mac. I've also tried downgrading to ng-poly 0.11.2 and 0.11.1 and got the same behavior.

dustinspecker commented 8 years ago

Weird. Does using yo ng-poly:service a --module=home work? I'll try to look into this tonight.

d-rep commented 8 years ago

Yes - that's a good workaround, thanks Dustin.

$ yo ng-poly:service a --module=home
Module file names without a `-module` prefix are deprecated. Official support will be dropped in v0.12.0. Add a `-module` prefix to be officially supported.
Module file names without a `-module` prefix are deprecated. Official support will be dropped in v0.12.0. Add a `-module` prefix to be officially supported.
   create app/home/a-service.js
   create app/home/a-service_test.js
dustinspecker commented 8 years ago

I haven't been able to reproduce this on my Mac. Is your project public by any chance? Or even a file structure with changed names?

Not sure why the module choice selector doesn't work, while the module flag does work.

javierquevedo commented 8 years ago

After selecting the module generating a directive, I get the error below. I alsoget the same error if I type the module manually: yo ng-poly:directive someDirective --module=base/someModule

My project uses typescript. Ubuntu 14.04 LTS npm version: 2.14.12 ng-poly version: 1.5.1 Thanks in advance. TypeError: Cannot read property 'indexOf' of undefined at Object.findModuleFile$ (..../generator-ng-poly/generators/utils/module.js:228:25) at tryCatch .....(/node_modules/generator-ng-poly/node_modules/babel- polyfill/node_modules/babel-regenerator-runtime/runtime.js:61:40) at GeneratorFunctionPrototype.invoke [as _invoke] (...../node_modules/generator-ng-poly/node_modules/babel- polyfill/node_modules/babel-regenerator-runtime/runtime.js:329:22)

dustinspecker commented 8 years ago

I believe this has been fixed, if not please feel free to re-open.