gpt4 book ai didi

node.js - 错误 : uncaughtException: require(. ..).invokeRolesPolicies 不是函数

转载 作者:太空宇宙 更新时间:2023-11-04 00:38:26 25 4
gpt4 key购买 nike

我正在使用 MEAN.JS 开发一个 Web 应用程序,但由于某种原因,在我做了一些更改(主要是将新模块复制并粘贴到应用程序中)后,我看到了如下错误:

error: uncaughtException: require(...).invokeRolesPolicies is not a function

我不知道为什么会发生这种情况,有人知道如何解决这个问题吗?

这是完整的错误消息:

TypeError: require(...).invokeRolesPolicies is not a function at C:\oferdo\oferdo\config\lib\express.js:180:39 at Array.forEach (native) at Object.module.exports.initModulesServerPolicies (C:\oferdo\oferdo\config\lib\express.js:179:32) at Object.module.exports.init (C:\oferdo\oferdo\config\lib\express.js:252:8) at C:\oferdo\oferdo\config\lib\app.js:29:23 at C:\oferdo\oferdo\config\lib\mongoose.js:36:15 at C:\oferdo\oferdo\node_modules\mongoose\lib\connection.js:284:19 at open (C:\oferdo\oferdo\node_modules\mongoose\lib\connection.js:511:17) at C:\oferdo\oferdo\node_modules\mongoose\lib\connection.js:518:7 at C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\lib\db.js:1504:5 at handleCallback (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\lib\utils.js:96:12) at _callback (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\lib\db.js:1420:5) at C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\lib\db.js:1463:7 at C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:1416:5 at finish (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\auth\scram.js:157:16) at handleEnd (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\auth\scram.js:170:7) at C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\auth\scram.js:264:17 at commandCallback (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:1194:9) at Callbacks.emit (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:119:3) at null.messageHandler (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:358:23) at Socket. (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\connection\connection.js:292:22) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7) at readableAddChunk (_stream_readable.js:153:18) at Socket.Readable.push (_stream_readable.js:111:10) at TCP.onread (net.js:531:20)

最佳答案

实际上,这与错误命名的文件无关。

您需要确保在策略文件中定义了 invokeRolesPolicies 函数。最低要求是:

'use strict';

var acl = require('acl');
acl = new acl(new acl.memoryBackend());

exports.invokeRolesPolicies = function () {};

原因是mean.js中定义的express.js库假设它已设置,并尝试调用它,因此出现错误。

关于node.js - 错误 : uncaughtException: require(. ..).invokeRolesPolicies 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37894609/

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