_Thanks for wanting to report an issue you've found in node_redis. Please delete
this text and fill in the template below. Please note that the issue tracker is only
for bug reports or feature requests. If you have a question, please ask that on [gitter].
If unsure about something, just do as best as you're able._
_Note that it will be much easier to fix the issue if a test case that reproduces
the problem is provided. It is of course not always possible to reduce your code
to a small test case, but it's highly appreciated to have as much data as possible.
Thank you!_
Hi Folks,
I'm trying to create Redis Client using this
var redis = require('redis');
var redisClient = redis.createClient({host:'127.0.0.1', port:6379});
but it throws me this errors
else {
82 | cnx_options.port = +options.port || 6379;
83 | cnx_options.host = options.host || '127.0.0.1';
84 | cnx_options.family = !options.family && net.isIP(cnx_options.host) || (options.family === 'IPv6' ? 6 : 4);
| ^ 85 | this.address = cnx_options.host + ':' + cnx_options.port;
86 | } // Warn on misusing deprecated functions
87 |
Please anyone suggest any workaround on this.
Thanks
I am facing the same issue when I changed line 3 in redis index.js file to var net = require('net-browserify');
for sure this is not a proper solution or work around but this fixes the issue for now until finding i find a solution
Which node version are you having this issue on?
I am facing the same issue when I changed line 3 in redis index.js file to var net = require('net-browserify');
for sure this is not a proper solution or work around but this fixes the issue for now until finding i find a solution
Here it is also fixed by this way. Thanks.
You're my hero. Thanks a lot!
how about this Issue? I am facing the same issue!!!!!
npx create-react-app test_redis_react --typescript
cd test_redis_react
yarn add redis
info Direct dependencies
โโ [email protected]
info All dependencies
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โจ Done in 8.19s.
I fixed App.tsx like this
import React from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
const redis = require('redis');
let client:any = redis.createClient(6379, "127.0.0.1", {db: 3});
client.get("key", redis.print);
return (
<div className="App">
<header className="App-header">
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
</header>
</div>
);
}
export default App;
It's wrong!!!
Download the React DevTools for a better development experience: https://fb.me/react-devtools
index.js:67 Uncaught TypeError: net.isIP is not a function
at new RedisClient (index.js:67)
at Object.push../node_modules/redis/index.js.exports.createClient (index.js:1022)
at App (App.tsx:7)
at renderWithHooks (react-dom.development.js:14803)
at mountIndeterminateComponent (react-dom.development.js:17482)
at beginWork (react-dom.development.js:18596)
at HTMLUnknownElement.callCallback (react-dom.development.js:188)
at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
at invokeGuardedCallback (react-dom.development.js:292)
at beginWork$1 (react-dom.development.js:23203)
at performUnitOfWork (react-dom.development.js:22157)
at workLoopSync (react-dom.development.js:22130)
at performSyncWorkOnRoot (react-dom.development.js:21756)
at scheduleUpdateOnFiber (react-dom.development.js:21188)
at updateContainer (react-dom.development.js:24373)
at react-dom.development.js:24758
at unbatchedUpdates (react-dom.development.js:21903)
at legacyRenderSubtreeIntoContainer (react-dom.development.js:24757)
at Object.render (react-dom.development.js:24840)
at Module../src/index.tsx (index.tsx:7)
at __webpack_require__ (bootstrap:784)
at fn (bootstrap:150)
at Object.1 (serviceWorker.ts:149)
at __webpack_require__ (bootstrap:784)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.chunk.js:1
node --version
v12.18.3
npm --version
6.14.6
I printed net in App.tsx,
result like this:
net:
Object
__proto__:
constructor: ฦ Object()
hasOwnProperty: ฦ hasOwnProperty()
isPrototypeOf: ฦ isPrototypeOf()
propertyIsEnumerable: ฦ propertyIsEnumerable()
toLocaleString: ฦ toLocaleString()
toString: ฦ toString()
valueOf: ฦ valueOf()
__defineGetter__: ฦ __defineGetter__()
__defineSetter__: ฦ __defineSetter__()
__lookupGetter__: ฦ __lookupGetter__()
__lookupSetter__: ฦ __lookupSetter__()
get __proto__: ฦ __proto__()
set __proto__: ฦ __proto__()
The net module is the base Module of node.js, BUT it's miss in this tsx file!!!
WHY? And How Can I do?
Most helpful comment
I am facing the same issue when I changed line 3 in redis index.js file to var net = require('net-browserify');
for sure this is not a proper solution or work around but this fixes the issue for now until finding i find a solution