HP. HP. - 3 months ago 50
Javascript Question

Most middleware (like compress) is no longer bundled with Express

I just installed sails@v0.9.16, express@4.0.0, compression@1.0.1 and compress@0.1.9 (just to make sure). But I still have following error when running

sails lift

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?


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!