I just installed [email protected], [email protected], [email protected] and [email protected] (just to make sure). But I still have following error when running sails lift
/Users/myuser/myproject/backend/node_modules/express/lib/express.js:89
throw new Error('Most middleware (like ' + name + ') is no longer bundle
^
Error: Most middleware (like compress) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.
at Function.Object.defineProperty.get (/Users/myuser/myproject/backend/node_modules/express/lib/express.js:89:13)
at Object.module.exports.express.customMiddleware (/Users/myuser/myproject/backend/config/passport.js:127:20)
at Array.loadExpress [as 1] (/usr/local/lib/node_modules/sails/lib/express/index.js:162:25)
at listener (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:462:46)
at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:416:17
at Array.forEach (native)
at _each (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:32:24)
at Object.taskComplete (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:415:13)
at processImmediate [as _immediateCallback] (timers.js:330:15)
Any idea why?
Compression middleware compresses response bodies for all given requests that traverse through the middleware. The middleware will not compress responses that include Cache-Control header with the no-transform directives. This is because doing so will transform the body.
Compression in Node. js and Express decreases the downloadable amount of data that's served to users. Through the use of this compression, we can improve the performance of our Node. js applications as our payload size is reduced drastically. There are two methods of compression.
Sails does not officially support Express 4; there's a reason the Express dependency in the Sails package.json
is set to an explicit version! You can use the other answers here to try and get your Sails app running, but you're on your own until we update the core to make use of the new Express.
We are planning on reaching out to the Express team to try and synchronize releases better in the future, but at the moment we're working hard on getting out a stable release of Sails v0.10!
It's not enough to just install those dependencies in express 4.0.
You now need to include them in Your app with
var compression = require('compression');
and then use it.
There is quite nice article here: link
and also here: link
on how to deal with migrating from expres 3.x.x to 4.x.x
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With