Predis is a lightweight wrapper around the node-redis (node_redis) library that converts callback-based Redis commands to return Promises instead, simplifying asynchronous code with .then() and .catch(). Version 1.1.4 is the latest stable release; the package has not been updated since 2019 and relies on the older node_redis v0.x. It requires Node >=8. It is a minimal layer — it does not add TypeScript types, and does not support modern Redis features or the 'ioredis' alternative's cluster/sentinel support. For new projects, consider using ioredis or the native promise support in newer node-redis (v4+).
npm install predisNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to Redis, sets and gets a key using promises, then disconnects.
Wrap multi exec in a new Promise constructor: new Promise((resolve, reject) => { multi.exec((err, replies) => { if (err) reject(err); else resolve(replies); }); });Migrate to a maintained Redis client like ioredis or the official redis v4 with built-in Promise support.
Use require('predis') or wrap with module.createRequire if using ES modules.Use { server: '127.0.0.1', port: 6379 } instead of { host: '...' }.Replace 'import predis from \"predis\"' with 'const predis = require(\"predis\")'.
Ensure you are using the predis client (not the raw redis client) and do not pass a callback.
Start redis-server or provide correct { server, port } options to createClient.Upgrade to a modern Redis client like ioredis.