I am trying to install blueimp-file-upload-expressjs
using the following command:
npm i --save blueimp-file-upload-expressjs
but I having the following error:
npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No README data npm WARN deprecated [email protected]: This package is no longer maintained. See its readme for upgrade details. > [email protected] install /Users/cell/Desktop/AtelierBeatsProject/AtelierBeats/node_modules/blueimp-file-upload-expressjs/node_modules/lwip > node-gyp rebuild 2015-11-29 15:25:47.811 xcodebuild[26274:1595302] [MT] PluginLoading: Required plug-in compatibility UUID 7265231C-39B4-402C-89E1-16167C4CC990 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/ClangFormat.xcplugin' not present in DVTPlugInCompatibilityUUIDs 2015-11-29 15:25:47.812 xcodebuild[26274:1595302] [MT] PluginLoading: Skipping plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/D for Xcode.xcplugin' because it is not compatible with this version of Xcode. CXX(target) Release/obj.target/lwip_decoder/src/decoder/init.o In file included from ../src/decoder/init.cpp:1: In file included from ../src/decoder/decoder.h:13: ../node_modules/nan/nan.h:120:25: error: redefinition of '_NanEnsureLocal' NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:115:25: note: previous definition is here NAN_INLINE v8::Local _NanEnsureLocal(v8::Handle val) { ^ ../node_modules/nan/nan.h:207:68: error: too many arguments to function call, expected at most 2, have 4 return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv); ~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~ /Users/cell/.node-gyp/4.2.1/include/node/v8.h:4675:3: note: 'New' declared here static Local New( ^ In file included from ../src/decoder/init.cpp:1: In file included from ../src/decoder/decoder.h:13: ../node_modules/nan/nan.h:289:3: error: redefinition of 'NanNew' NanNew >( ^ ../node_modules/nan/nan.h:282:3: note: previous definition is here NanNew >( ^ ../node_modules/nan/nan.h:307:36: error: redefinition of 'NanNew' NAN_INLINE v8::Local NanNew( ^ ../node_modules/nan/nan.h:301:36: note: previous definition is here NAN_INLINE v8::Local NanNew( ^ ../node_modules/nan/nan.h:319:36: error: redefinition of 'NanNew' NAN_INLINE v8::Local NanNew( ^ ../node_modules/nan/nan.h:313:36: note: previous definition is here NAN_INLINE v8::Local NanNew( ^ ../node_modules/nan/nan.h:531:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent()))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:517:43: note: expanded from macro 'NanEscapeScope' # define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) ^~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:120:25: note: candidate template ignored: substitution failure [with T = v8::Primitive] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:536:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(NanNew(v8::Null(v8::Isolate::GetCurrent()))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:517:43: note: expanded from macro 'NanEscapeScope' # define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) ^~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:120:25: note: candidate template ignored: substitution failure [with T = v8::Primitive] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:541:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent()))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:517:43: note: expanded from macro 'NanEscapeScope' # define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) ^~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:120:25: note: candidate template ignored: substitution failure [with T = v8::Boolean] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:546:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(NanNew(v8::False(v8::Isolate::GetCurrent()))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:517:43: note: expanded from macro 'NanEscapeScope' # define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) ^~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:120:25: note: candidate template ignored: substitution failure [with T = v8::Boolean] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:778:13: error: no member named 'smalloc' in namespace 'node' , node::smalloc::FreeCallback callback ~~~~~~^ ../node_modules/nan/nan.h:789:12: error: no matching function for call to 'New' return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); ^~~~~~~~~~~~~~~~~ /Users/cell/.node-gyp/4.2.1/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to 'enum encoding' for 3rd argument NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, ^ /Users/cell/.node-gyp/4.2.1/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char *') would lose const qualifier NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, ^ /Users/cell/.node-gyp/4.2.1/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, size_t length); ^ /Users/cell/.node-gyp/4.2.1/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, ^ In file included from ../src/decoder/init.cpp:1: In file included from ../src/decoder/decoder.h:13: ../node_modules/nan/nan.h:793:12: error: no viable conversion from 'v8::MaybeLocal' to 'v8::Local' return node::Buffer::New(v8::Isolate::GetCurrent(), size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/cell/.node-gyp/4.2.1/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::MaybeLocal' to 'const v8::Local &' for 1st argument class Local { ^ /Users/cell/.node-gyp/4.2.1/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::MaybeLocal' to 'v8::Local &&' for 1st argument class Local { ^ /Users/cell/.node-gyp/4.2.1/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal' V8_INLINE Local(Local that) ^ /Users/cell/.node-gyp/4.2.1/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::MaybeLocal' V8_INLINE Local(S* that) ^ In file included from ../src/decoder/init.cpp:1: In file included from ../src/decoder/decoder.h:13: ../node_modules/nan/nan.h:800:26: error: no member named 'Use' in namespace 'node::Buffer' return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); ~~~~~~~~~~~~~~^ ../node_modules/nan/nan.h:1897:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:517:43: note: expanded from macro 'NanEscapeScope' # define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) ^~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:120:25: note: candidate template ignored: substitution failure [with T = v8::Function] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:1912:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(node::MakeCallback( ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:517:43: note: expanded from macro 'NanEscapeScope' # define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) ^~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:120:25: note: candidate template ignored: substitution failure [with T = v8::Value] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:1985:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(handle->Get(NanNew(key)).As()); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:517:43: note: expanded from macro 'NanEscapeScope' # define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) ^~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:120:25: note: candidate template ignored: substitution failure [with T = v8::Object] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ 16 errors generated. make: *** [Release/obj.target/lwip_decoder/src/decoder/init.o] Error 1 gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Darwin 14.5.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/cell/Desktop/AtelierBeatsProject/AtelierBeats/node_modules/blueimp-file-upload-expressjs/node_modules/lwip gyp ERR! node -v v4.2.1 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok npm ERR! Darwin 14.5.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "--save" "blueimp-file-upload-expressjs" npm ERR! node v4.2.1 npm ERR! npm v2.14.7 npm ERR! code ELIFECYCLE npm ERR! [email protected] install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the lwip package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls lwip npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /Users/cell/Desktop/AtelierBeatsProject/AtelierBeats/npm-debug.log
It seems a compatibility problem...
The express-fileupload handle multiple files upload by assigning each file to the req.files object. You can retrieve the uploaded files from the req.files. [name] as shown below: Just like in the single upload example, you need to take note of the name attribute you used in your HTML page.
Then, enable the express-fileupload middleware by calling app.use () method: Create the index / route that will serve an index.html file as follows: Now you need to create an index.html that will be rendered by Express when the browser sends a request to the index / route.
When you upload a file and submit the form, an ENOENT error will occur because the files/ folder does not exist. To prevent the ENOENT error, you need to create the files/ folder manually in your project folder. Alternatively, you can also set the createParentPath option to true when you call the fileUpload () function inside app.use () method.
Had same issue. Got success in installation with this:
npm install arvindr21/blueimp-file-upload-expressjs
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