Estoy usando el paquete npm node-redis versión 3.1.0 e incluí lo siguiente en mi archivo .vue , específicamente en el bloque <script></script> :
import { createClient } from 'redis'; Dentro de los methods para export default , tengo lo siguiente:
async getVal(redisKey) { const client = createClient(); // eslint-disable-next-line client.on('error', (err) => console.log('Redis Client Error', err)); await client.connect(); const value = await client.get(redisKey); return value; },El código se compila sin errores, pero cuando abro mi sitio en el navegador, aparece el siguiente error en la consola de mi navegador:
index.js:3 Uncaught TypeError: Cannot read properties of undefined (reading 'charCodeAt') at Object.<anonymous> (index.js:3) at Object.f3c2 (chunk-vendors.bcef36a0.js:73) at i (bootstrap:79) at Object.b620 (customErrors.js:5) at i (bootstrap:79) at Object.<anonymous> (index.js:9) at Object.a111 (chunk-vendors.bcef36a0.js:41) at i (bootstrap:79) at Module.56d7 (app.05cc1827.js:1) at i (bootstrap:79) (anonymous) @ index.js:3 f3c2 @ chunk-vendors.bcef36a0.js:73 i @ bootstrap:79 b620 @ customErrors.js:5 i @ bootstrap:79 (anonymous) @ index.js:9 a111 @ chunk-vendors.bcef36a0.js:41 i @ bootstrap:79 56d7 @ app.05cc1827.js:1 i @ bootstrap:79 0 @ app.05cc1827.js:1 i @ bootstrap:79 a @ bootstrap:45 (anonymous) @ bootstrap:152 (anonymous) @ app.05cc1827.js:1 index.js :
'use strict' const Errors = process.version.charCodeAt(1) < 55 && process.version.charCodeAt(2) === 46 ? require('./lib/old') // Node.js < 7 : require('./lib/modern') module.exports = Errors¿Cómo puedo solucionar esto? No entiendo qué estoy haciendo mal que podría causar este error.