JavaEar 专注于收集分享传播有价值的技术资料

Sailjs error on user model : error: A hook (`orm`) failed to load

I have created a simple app using sailjs. while running the application it gives e below error

error: A hook (`orm`) failed to load!
error: `include-all` attempted to `require(G:\workspare\web\sailsapp\api\models\Users.js)`, but an error occurred::
Details:SyntaxError: Unexpected identifier
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)

My users.js model is like

module.exports = {

  attributes: {
    id : {
      type : 'integer',
      unique : true,
      primaryKey: true
    userName : {
      type : 'string'
      required : true     
    email : {
      type : 'email',
      required : true,
      unique : true
    ePassword : {
      type : 'string'
  • Sail : v0.12.9
  • Node : v4.2.6

I have checked the other answers but it is not useful for me.can anyone tell me what I am doing wrong/how can I overcome from this error?


  1. error: 'include-all' attempted to 'require(G:\workspare\web\sailsapp\api\models\Users.js)', but an error occurred::

    Means that there was an error in Users.js.

    Details:SyntaxError: Unexpected identifier

    Usually is caused by a syntactic error, a missing comma, parenthesis, bracket, etc. In this case, it is a missing comma.

    userName : {
          type : 'string' , // <---
          required : true