为什么是JSON中位置0处的意外令牌m?

时间:2018-11-14 12:15:18

标签: node.js ssms loopback

我正在使用环回以使用MSSQL创建api。我已经使用了一个教程,尽管我已经完成了所有步骤,但是当我运行server.js文件时,它会向我返回此信息。

 Unexpected token m in JSON at position 0

 at JSON.parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:707:27)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at loadModelDefinition (C:\Users\M\cile\node_modules\loopback-boot\lib\compiler.js:470:20)
    at C:\Users\M\cile\node_modules\loopback-boot\lib\compiler.js:363:21
    at Array.forEach (<anonymous>)
    at C:\Users\M\cile\node_modules\loopback-boot\lib\compiler.js:361:8
    at Array.forEach (<anonymous>)
    at findModelDefinitions (C:\Users\M\cile\node_modules\loopback-boot\lib\compiler.js:348:11)
    at buildAllModelInstructions (C:\Users\M\cile\node_modules\loopback-boot\lib\compiler.js:225:16)
    at compile (C:\Users\M\cile\node_modules\loopback-boot\lib\compiler.js:106:27)
    at bootLoopBackApp (C:\Users\M\cile\node_modules\loopback-boot\index.js:153:22)

你能告诉我怎么了吗?

这是模型配置代码:

{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ]
  },
  "User": {
    "dataSource": "db"
  },
  "AccessToken": {
    "dataSource": "db",
    "public": false
  },
  "ACL": {
    "dataSource": "db",
    "public": false
  },
  "RoleMapping": {
    "dataSource": "db",
    "public": false
  },
  "Role": {
    "dataSource": "db",
    "public": false
  },
  "Hello": {
    "dataSource": "mySqlServer",
    "public": true
  }
}

这是普通文件中的.json文件代码

module.exports = function(hello) { 

};

0 个答案:

没有答案