[英]sails-auth module gives “Cannot read property 'loadStrategies' of undefined”
I've installed the npm module and when lifting my application, it gives the following error. 我已经安装了npm模块,当解除我的应用程序时,它会出现以下错误。 I was not able to find any suitable solution in the GitHub Issues or Wiki. 我无法在GitHub问题或Wiki中找到任何合适的解决方案。
The module is here . 该模块在这里 。 I've already included in my config directory passport.js and auth.js files, as they have noted. 我已经在我的配置目录中包含了passport.js和auth.js文件,正如他们已经注意到的那样。
$ sails lift
info: Starting app...
/home/me/Documents/projects/margin/node_modules/sails-auth/api/hooks/sails-auth.js:4
sails.services.passport.loadStrategies();
^
TypeError: Cannot read property 'loadStrategies' of undefined
at Hook.initialize (/home/me/Documents/projects/margin/node_modules/sails-auth/api/hooks/sails-auth.js:4:30)
at Hook.bound [as initialize] (/usr/local/lib/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
at /usr/local/lib/node_modules/sails/lib/hooks/index.js:75:14
at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:454:17
at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:444:17
at Array.forEach (native)
at _each (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:46:24)
at Immediate.taskComplete (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:443:13)
at processImmediate [as _immediateCallback] (timers.js:358:17)
I had the same problems in one of my sails app repositories. 我在我的一个应用程序存储库中遇到了同样的问题。 I fixed it by installing a previous version of sails-auth. 我通过安装以前版本的sails-auth来修复它。
npm install sails-auth@1.2.3
This fixed it for me. 这为我修好了。 I also updated dependency reference for my package.json
from 我还更新了我的package.json
依赖引用
"sails-auth": "^1.0.10",
to 至
"sails-auth": "1.2.3",
After this I was able to lift with no problems. 在此之后我能够毫无问题地举起。 I created an issue report here: https://github.com/balderdashy/sails/issues/3385 我在这里创建了一个问题报告: https : //github.com/balderdashy/sails/issues/3385
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.