trailsjs / sails-auth

Passport-based User Authentication system for sails.js applications. Designed to work well with the sails-permissions module.
https://www.npmjs.org/package/sails-auth
MIT License
266 stars 141 forks source link

sails-auth module gives “Cannot read property 'loadStrategies' of undefined” on update #114

Open drj-io opened 8 years ago

drj-io commented 8 years ago

This is from a repository that I originally started in sails .11.0.0. Later cloning my app repo and doing npm install breaks my app.

$ sails lift

info: Starting app...

/home/david/x/webapp/node_modules/sails-auth/api/hooks/sails-auth.js:4 sails.services.passport.loadStrategies(); ^ TypeError: Cannot call method 'loadStrategies' of undefined at Hook.initialize (/home/david/x/webapp/node_modules/sails-auth/api/hooks/sails-auth.js:4:31) at Hook.bound as initialize at /home/david/x/webapp/node_modules/sails/lib/hooks/index.js:75:14 at /home/david/x/webapp/node_modules/sails/node_modules/async/lib/async.js:451:17 at /home/david/x/webapp/node_modules/sails/node_modules/async/lib/async.js:441:17 at _each (/home/david/x/webapp/node_modules/sails/node_modules/async/lib/async.js:46:13) at Object.taskComplete (/home/david/x/webapp/node_modules/sails/node_modules/async/lib/async.js:440:13) at processImmediate as _immediateCallback This was working fine with sails-auth 1.0.10 but broke with sails-auth 1.2.3 .

Would love to be current. I answered this SO issue here too: http://stackoverflow.com/questions/32792853/sails-auth-module-gives-cannot-read-property-loadstrategies-of-undefined

klaoha06 commented 8 years ago

+1

klaoha06 commented 8 years ago

duplicate issue

befreestudios commented 8 years ago

+1 Having same issue.

YoleYu commented 8 years ago

+1 I'm new to sailsJS, do not know why this happened. Reproduce Step:

  1. sails new sails-auth-test
  2. cd sails-auth-test/
  3. $ npm install sails-auth --save sails-auth@1.3.1 node_modules\sails-auth ├── passport-twitter@1.0.3 (xtraverse@0.1.0, passport-oauth1@1.0.1) ├── passport-facebook@1.0.3 (passport-oauth2@1.1.2) └── passport-google-oauth@0.2.0 (pkginfo@0.3.1, passport-oauth@1.0.0)
  4. $ sails lift

info: Starting app...

C:\yole\code\sails-auth-test\node_modules\sails-auth\api\hooks\sails-auth.js:4 sails.services.passport.loadStrategies(); ^

TypeError: Cannot read property 'loadStrategies' of undefined at Hook.initialize (C:\yole\code\sails-auth-test\node_modules\sails-auth\api\hooks\sails-auth.js:4:30) at Hook.bound as initialize at C:\Users\yinglli\AppData\Roaming\npm\node_modules\sails\lib\hooks\index.js:74:14 at C:\Users\yinglli\AppData\Roaming\npm\node_modules\sails\node_modules\async\lib\async.js:451:17 at C:\Users\yinglli\AppData\Roaming\npm\node_modules\sails\node_modules\async\lib\async.js:441:17 at _each (C:\Users\yinglli\AppData\Roaming\npm\node_modules\sails\node_modules\async\lib\async.js:46:13) at Immediate.taskComplete (C:\Users\yinglli\AppData\Roaming\npm\node_modules\sails\node_modules\async\lib\async.js:440:13) at processImmediate as _immediateCallback

YoleYu commented 8 years ago

resolved by specify version to 2.1.1 in package.json