继续这个错误:
Sails Permissions AuditPolicy无法正常运行。任何人都可以指导我做。
O / P:
error: Sending 500 ("Server Error") response:
Error: Invalid route option, "model".
I don't know about any models named: `v1/user`
at Object.module.exports.parseModel (E:\demo- server\node_modules\sails\lib\hooks\blueprints\actionUtil.js:266:25)
at ModelPolicy (E:\demo-server\node_modules\sails-permissions\api\policies\ModelPolicy.js:8:42)
at routeTargetFnWrapper (E:\demo-server\node_modules\sails\lib\router\bind.js:179:5)
at callbacks (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:164:37)
at param (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:138:11)
at pass (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:145:5)
at nextRoute (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:100:7)
at callbacks (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:167:11)
at E:\demo-server\node_modules\sails\lib\router\bind.js:187:7
at _sendHeaders (E:\demo-server\node_modules\sails\lib\hooks\cors\index.js:191:4)
at routeTargetFnWrapper (E:\demo-server\node_modules\sails\lib\router\bind.js:179:5)
at callbacks (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:164:37)
at param (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:138:11)
at pass (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:145:5)
at nextRoute (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:100:7)
at callbacks (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:167:11)
at E:\demo-server\node_modules\sails\lib\router\bind.js:187:7
at sails.router.bind._middlewareType (E:\demo-server\node_modules\sails\lib\hooks\csrf\index.js:102:11)
at routeTargetFnWrapper (E:\demo-server\node_modules\sails\lib\router\bind.js:179:5)
at callbacks (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:164:37)
at param (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:138:11)
at pass (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:145:5)
at nextRoute (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:100:7)
at callbacks (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:167:11)
at E:\demo-server\node_modules\sails\lib\router\bind.js:187:7
at _addResViewMethod (E:\demo-server\node_modules\sails\lib\hooks\views\res.view.js:325:3)
at routeTargetFnWrapper (E:\demo-server\node_modules\sails\lib\router\bind.js:179:5)
at callbacks (E:\demo-server\node_modules\sails\node_modules\express\lib\router\index.js:164:37) [Error: Invalid route option, "model".
I don't know about any models named: `v1/user`]
感谢你的耐心,我的路障会引导我。
silly: Registering model `v1-user` in Waterline (ORM)
E:\demo-server\node_modules\sails\node_modules\waterline\node_modules\waterline-schema\lib\waterline-schema\foreignKeys.js:82
throw new Error('Trying to access a collection ' + collection + ' that is not defined.');
^
Error: Trying to access a collection user that is not defined.
at ForeignKeys.findPrimaryKey (E:\demo-server\node_modules\sails\node_modules\waterline\node_modules\waterline-schema\lib\waterline-schema\foreignKeys.js:82:11)
at ForeignKeys.replaceKeys (E:\demo-server\node_modules\sails\node_modules\waterline\node_modules\waterline-schema\lib\waterline-schema\foreignKeys.js:53:27)
答案 0 :(得分:1)
如果禁用蓝图,您是如何尝试访问模型的,因为它看起来好像是在尝试使用蓝图,但您的上一个问题是说它们已被禁用。在任何情况下:
模型目前不能存在于子文件夹中。
要做你正在尝试做的事情,你可能只是在你的模型前面加上。这是我能想到的唯一方法。
models/V1-User.js
models/v1-stuff.js
models/v2-user.js
models/v2-stuff.js
并拥有您的配置
module.exports = {
_config: {
model: 'V1-User'
}