1

I'm using ExpressJS and have been trying to get PassportJS working. In my express.js config, I have the following:

app.configure(function () {
        // dynamic helpers
        app.use(helpers(config.app.name));

        // cookieParser should be above session
        app.use(express.cookieParser());

        // bodyParser should be above methodOverride
        app.use(express.bodyParser());
        app.use(express.methodOverride());

        // express/mongo session storage
        app.use(express.session({
          secret: 'noobjs',
          store: new mongoStore({
            url: config.db,
            collection : 'sessions'
          })
        }));

        // connect flash for flash messages
        app.use(flash());

        // use passport session
        app.use(passport.initialize());
        app.use(passport.session());

...

Unfortunately, I get the following error when I run the app:-

store.on('disconnect', function(){ storeReady = false; });
^
TypeError: Object #<Object> has no method 'on'

I think it has something to do with initialization order, but am too inexperienced around express to know what the order should be.

Can anyone offer some direction please?


Guard not compiling all the SCSS stylesheets

When you have a wrapper stylesheet that imports other using sass @import, and when using guard to watch for changes, it wont compile the wrapper stylesheet automatically if you are only changing one of the imported files. Example:

/* This is viewports.scss, which must compile into viewports.css */
@media only screen and (min-width: 480px) {
    @import "480.scss";
}

@media only screen and (min-width: 768px) {
    @import "768.scss";
}

@media only screen and (min-width: 1024px) {
    @import "1024.scss";
} 

When modifying for example 480up.scss, it compiles as expected into 480up.css, but Guard is not importing it into the viewports.css, seems like is not recognizing the dependency. This use is important when you want to implement responsive in one compiled css, but writing your code in separate scss files.

If you just use the sass command you have the expected behavior, if you use Guard, not.

Is there some workaround for this? Something extra that I need to configure?

4

1 回答 1

1

npm咬我的屁股。我拿错了包裹。问题解决了。

作为参考,正确的包是npm install connect-mongo.

于 2013-03-31T23:11:55.973 回答