【问题标题】:UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'type' of undefined #3090UnhandledPromiseRejectionWarning:未处理的承诺拒绝(拒绝 id:2):TypeError:无法读取未定义的属性“类型”#3090
【发布时间】:2017-05-29 00:02:12
【问题描述】:

我正在环回应用程序中创建模型之间的关系,但是当我执行以下命令时 slc loopback:relation我抛出以下错误。

错误

(node:6444) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'type' of undefined


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

TypeError: Cannot read property 'type' of undefined
    at C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\inquirer\lib\objects\choices.js:16:12
    at Array.map (native)
    at new module.exports (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\inquirer\lib\objects\choices.js:15:26)
    at Prompt.module.exports (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\inquirer\lib\prompts\base.js:43:24)
    at new Prompt (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\inquirer\lib\prompts\list.js:26:8)
    at PromptUI.fetchAnswer (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\inquirer\lib\ui\prompt.js:77:16)
    at tryCatcher (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:63:31)
    at InnerObserver.Rx.FlatMapObservable.InnerObserver.next (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:2140:43)
    at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:1762:31)
    at InnerObserver.tryCatcher (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:63:31)
    at AutoDetachObserverPrototype.next (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:5883:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:1762:31)
    at InnerObserver.next (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:3547:65)
    at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:1762:31)
    at InnerObserver.tryCatcher (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:63:31)
    at AutoDetachObserverPrototype.next (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:5883:51)

slc -v

strongloop v6.0.3 (node v6.9.2)
├── strong-arc@1.8.9 (3dd25ac)
├── strong-build@2.1.2 (a98f310)
├── strong-deploy@3.1.4 (9b29df0)
├── strong-mesh-models@8.1.0 (62e539b)
├── strong-pm@5.2.3
├── strong-registry@1.1.6 (f8c2339)
├── strong-start@1.3.4 (28c261d)
├─┬ strong-supervisor@3.3.3
│ └── strong-agent@2.1.1 (b51fc45)
├── generator-loopback@1.25.0 (6a0e2c0)
├── node-inspector@0.7.5 (16841d6)
└── nodefly-register@0.3.3

节点:6.9.2 npm: 3.10.9

我正在使用带有模型的 Mongodb

这是我的项目

https://github.com/rizvanhaider/node-shop

【问题讨论】:

标签: node.js loopbackjs strongloop


【解决方案1】:

问题已由https://github.com/strongloop/loopback/issues/3090#issuecomment-274183440 解决 问题是错误地将 model-config.json 文件放在 common/models/ 目录中。 如果有人遇到同样的环回问题,请检查您是否正确遵循项目结构,尤其是模型目录中没有多余或不需要的东西。

【讨论】:

    猜你喜欢
    • 2019-01-11
    • 2017-07-12
    • 1970-01-01
    • 2019-04-16
    • 1970-01-01
    • 1970-01-01
    • 2017-10-25
    • 2016-10-28
    • 2019-07-19
    相关资源
    最近更新 更多