gpt4 book ai didi

node.js - 用户模型上的 Sailjs 错误 : error: A hook (`orm` ) failed to load

转载 作者:太空宇宙 更新时间:2023-11-03 23:28:57 36 4
gpt4 key购买 nike

我使用sailjs创建了一个简单的应用程序。运行应用程序时出现以下错误

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)

我的 users.js 模型就像

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'
}
}
};
  • sails :v0.12.9
  • Node :v4.2.6

我已经检查了其他答案,但它对我没有用。任何人都可以告诉我我做错了什么/我该如何克服这个错误?

最佳答案

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

表示Users.js 中存在错误。

Details:SyntaxError: Unexpected identifier

通常是由于语法错误、缺少逗号、圆括号、中括号等引起的。在本例中,就是缺少逗号。

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

关于node.js - 用户模型上的 Sailjs 错误 : error: A hook (`orm` ) failed to load,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40450928/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com