Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. I was not able to find any suitable solution in the GitHub Issues or Wiki.

The module is here. I've already included in my config directory passport.js and auth.js files, as they have noted.

$ 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)
like image 408
VVulf Avatar asked Oct 19 '22 01:10

VVulf


1 Answers

I had the same problems in one of my sails app repositories. I fixed it by installing a previous version of sails-auth.

npm install [email protected]

This fixed it for me. I also updated dependency reference for my package.json from

"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

Hope this helps.

like image 200
drj Avatar answered Oct 24 '22 10:10

drj