环回使用未知的混合:时间戳

loopback uses unknown mixin: Timestamp

我正在将时间戳混合添加到我的模型中,但是当我 运行

node . 

我收到此错误:

/home/ubuntu/bike/node_modules/loopback/node_modules/loopback-datasource-juggler/lib/mixins.js:50
      throw new Error(errMsg);
      ^

Error: Model "BalanceHistory" uses unknown mixin: Timestamp
    at MixinProvider.applyMixin (/home/ubuntu/bike/node_modules/loopback/node_modules/loopback-datasource-juggler/lib/mixins.js:50:13)
    at ModelBuilder.defineClass [as define] (/home/ubuntu/bike/node_modules/loopback/node_modules/loopback-datasource-juggler/lib/model-builder.js:649:27)
    at Function.ModelClass.extend (/home/ubuntu/bike/node_modules/loopback/node_modules/loopback-datasource-juggler/lib/model-builder.js:447:33)
    at Registry.createModel (/home/ubuntu/bike/node_modules/loopback/lib/registry.js:122:25)
    at /home/ubuntu/bike/node_modules/loopback-boot/lib/executor.js:245:24
    at Array.forEach (native)
    at defineModels (/home/ubuntu/bike/node_modules/loopback-boot/lib/executor.js:229:23)
    at setupModels (/home/ubuntu/bike/node_modules/loopback-boot/lib/executor.js:197:3)
    at execute (/home/ubuntu/bike/node_modules/loopback-boot/lib/executor.js:40:3)
    at bootLoopBackApp (/home/ubuntu/bike/node_modules/loopback-boot/index.js:154:3)
    at Object.<anonymous> (/home/ubuntu/bike/server/server.js:23:1)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:140:18)
    at node.js:1043:3

在我的模型中-config.json我已经改为:

"_meta": {
"sources": [
  "loopback/common/models",
  "loopback/server/models",
  "../common/models",
  "./models"
],
"mixins": [
  "loopback/common/mixins",
  "../node_modules/loopback-ds-timestamp-mixin",
  "../common/mixins"
]}

奇怪的是,即使我已经更改为 ../node_modules/loopback-ds-timestamp-mixin,它仍然会加载 node_modules/loopback/node_modules/loopback-datasource-juggler/lib/mixins.js,这不是我想要的。有人知道如何正确设置吗?

loopback-ds-timestamp-mixin mixin 将自己定义为 TimeStamp;使用大写 "S" 所以在 BalanceHistory JSON 定义文件的 mixins 对象中以这种方式定义它。

顺便说一句,node_modules/loopback/node_modules/loopback-datasource-juggler/lib/mixins.js 是抛出异常的文件,它不是 loopback 寻找你的 mixins 的地方。