Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

366
Views
TypeError: Cannot set property '_toasts' of undefined

so, I was using express-toastr package on my application. Whenever i try to run the programme it gives me this error

C:\Users\Johaa Jnr\Desktop\loginApp\node_modules\express- 
toastr\index.js:71
req._toasts = [];
            ^

TypeError: Cannot set property '_toasts' of undefined

here's my app.js code

...
var session = require('express-session')
var cookieParser = require('cookie-parser')
var path = require('path')
var cors = require('cors')
var flash = require('connect-flash')
var toastr = require('express-toastr')

app.use(express.static(path.join(__dirname, 'public')))
app.use(express.urlencoded({ extended: false }))
app.use(cookieParser())
app.use(express.json())
app.use(session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: false,
cookie: { secure: false }

}))
app.use(flash())
app.use(toastr())
...

and here's my route

Router.get('/', csrfProtect, (req,res)=>{
var qry = req.query.q
if(qry){
req.toastr.error(qry)
}
res.render('signup', { req: req, csrfToken: req.csrfToken() })
})

I dont have the idea what am I doing wrong here? any solution to this problem ?

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!