Reputation: 179
My application with file upload worked good with express 3.x, but after upgrade express module to 4.x, it didn't work anymore. After searching, I knew the reason,because of the middleware for processing multipart/form-data request body data was removed from the bodyParser middleware. Then I tried to install multer, but can't install it, following error : npm ERR! Error: No compatible version found: busboy@'^0.2.6' npm ERR! Valid install targets:
So what can i do next with my application, I really want to use express 4.x, anyone help me please? Thank you.
Upvotes: 1
Views: 1935
Reputation: 13500
The caret (^
) indicates that you want to install a version of Busboy that is compatible with (in this case) 0.2.6.
The package that npm uses for comparing versions (semver
) added support for this in version 2.1.0
. npm uses that release since version 1.3.7
.
Your npm version doesn't understand what to do when you tell it to install '^0.2.6'. It's confused by the caret symbol.
According to your comment, you're running an npm installation that is older than that (1.3.5).
The solution is to update npm. Your node installation itself is probably outdated as well, since new releases of npm are usually bundled with node.
Upvotes: 0
Reputation: 32127
You need to use the body-parser middleware along with multer, since they are no longer bundled in with express.
var express = require('express')
var bodyParser = require('body-parser')
var multer = require('multer')
var app = express()
app.use(bodyParser()) //Formerly app.use(express.bodyParser())
app.use(multer({ dest: './uploads/'})) //Formerly app.use(express.multipart())
Upvotes: 3