0

i have a problem with Node.js running on a raspberry pi with linux operating system.

On my local computer the program just runs fine. But as soon as i start it on the pi I receive following error message

TypeError: app.use() requires middleware functions
    at EventEmitter.use     (/var/www/node_modules/express/lib/application.js:209:11)
    at Object.<anonymous> (/var/www/html/server.js:57:5)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:134:18)
    at node.js:962:3

I took some research and as mentioned in other posts I have installed multer. But now I get the error message still at this point. My question is, since iam new to Nodejs, what exactly does it mean and how can i possibly fix it? How do I use multer at this point?

app.use( expressSession({
                cookie:
                {
                        maxAge: 36000000,
                        httpOnly: false
                },
                secret:'abc123'
}) );
clyx
  • 82
  • 1
  • 8

1 Answers1

0

I had the same problem, but it was because while including multer, I forgot to remove the semicolon preceding. So it could not be included

error:

var path= require('path'),
    ...
    moment = require('moment'); // this was the error  
    multer = require('multer');

correct:

var path= require('path'), 
    ...
    moment = require('moment'), // this is correct (I know it's silly error :) )
    multer = require('multer');
Blo
  • 11,903
  • 5
  • 45
  • 99
FBN
  • 1