koa-generic-session 报错 server error TypeError: Cannot set property name of which has only a gett...
事情是介个样子的:
我给项目新配置了新的 redis 接口,再运行项目后,一直报错,说不能设置只有 getter 的属性名:
server error TypeError: Cannot set property name of which has only a getter
at defaultErrorHanlder (/Users/name/code/node_modules/koa-generic-session/lib/session.js:558:12)
at /Users/name/code/node_modules/koa-generic-session/lib/session.js:98:13
at Generator.throw ()
at step (/Users/name/code/node_modules/koa-generic-session/lib/session.js:3:191)
at /Users/name/code/node_modules/koa-generic-session/lib/session.js:3:402
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
request: {
method: 'GET',
url: '/favicon.ico',
header: {
host: 'localhost:3000',
connection: 'keep-alive',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36',
'sec-fetch-dest': 'image',
accept: 'image/webp,image/apng,image/*,*/*;q=0.8',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'no-cors',
referer: 'http://localhost:3000/',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9',
cookie: 'koa.sid=OdvWGWA1RUH_IXywo3Cyc_jz3j9kr7iJ; koa.sid.sig=rLchHBrwX0adJ6O93FBTkbDaBwY'
}
},
response: {
status: 404,
message: 'Not Found',
header: [Object: null prototype] {}
},
app: { subdomainOffset: 2, proxy: false, env: 'development' },
originalUrl: '/favicon.ico',
req: '',
res: '',
socket: ''
}
解决:重新启动 redis。
$ redis-server restart
发表评论 (审核通过后显示评论):