Sails のmoduleについて

イシュー

  • Sails でソーシャルログインできるまで作りたい
  • とりいそぎ、passportモジュールでソーシャルログインを実装してみる

linker ?

  • v.0.10.x で特に必要でなくなったっぽい

    参考

  • sails.js - SailsJS v0.10 create new project --linker not working Gruntfile.js not used - Stack Overflow

    Sails v0.10 no longer uses the linker folder--it was just causing confusion. If you have the linker option enabled, then any assets under your assets folder will be copied over to your .tmp/public folder by Grunt when Sails is lifted.

    Salis v0.10はもはやlinker フォルダを使用しない - それだけで混乱を引き起こしていた。 もしlinkerオプションが有効になっている場合は、つぎにSails を持ち上げた時に、Grunt によってasset フォルダの下にあるファイル群が .tmp/public フォルダにコピーされます。

Cannot find module 'passport'

  • npm install で解消
$ npm install passport
passport@0.2.0 node_modules/passport
├── pause@0.0.1
└── passport-strategy@1.0.0
$

参考

heroku 上で module 使うには?

2014-08-02T06:40:24.376739+00:00 app[web.1]: debug: Lowering sails...
2014-08-02T06:40:25.300905+00:00 app[web.1]: > sails-sb1@0.0.0 start /app
2014-08-02T06:40:25.300887+00:00 app[web.1]: 
2014-08-02T06:40:25.300909+00:00 app[web.1]: 
2014-08-02T06:40:25.300908+00:00 app[web.1]: > node app.js
2014-08-02T06:40:25.596154+00:00 app[web.1]: 
2014-08-02T06:40:25.596164+00:00 app[web.1]: module.js:340
2014-08-02T06:40:25.596165+00:00 app[web.1]:     throw err;
2014-08-02T06:40:25.596167+00:00 app[web.1]:           ^
2014-08-02T06:40:25.596169+00:00 app[web.1]: Error: Cannot find module 'passport'
2014-08-02T06:40:25.596173+00:00 app[web.1]:     at Module.require (module.js:364:17)
2014-08-02T06:40:25.596174+00:00 app[web.1]:     at require (module.js:380:17)
2014-08-02T06:40:25.596171+00:00 app[web.1]:     at Function.Module._load (module.js:280:25)
2014-08-02T06:40:25.596176+00:00 app[web.1]:     at Object.<anonymous> (/app/config/passport.js:1:78)
2014-08-02T06:40:25.596177+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2014-08-02T06:40:25.596178+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2014-08-02T06:40:25.596180+00:00 app[web.1]:     at Module.load (module.js:356:32)
2014-08-02T06:40:25.596182+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2014-08-02T06:40:25.596170+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:338:15)
2014-08-02T06:40:25.607768+00:00 app[web.1]: npm ERR! sails-sb1@0.0.0 start: `node app.js`
  • package.json で、実行可能なscriptを記述できるので、grunt タスクをつくって、その中で" npm install --production " してやればいいっぽい
  • とりあえず、node_modules をコミットしてもいける(けどキャッシュされてしまう)

参考

heroku addon

heroku addons:add heroku-postgresql