Uncaught TypeError: net.connect is not a function
See original GitHub issueI try to use ldapjs in my react app to do user authentification. Everything is installed by npm and is the latest version. I already have openldap as my server. And I import ldapjs into my code:
var ldap = require('ldapjs');
var client = ldap.createClient({
url: 'ldap://192.168.1.90:389'
})
const baseDN = 'dc=mnw-inc,dc=com'
export function login(username, password) {
client.bind(rootDN, rootpasswd, function(err, res) {
// here handle response
})
}
Run my react app and I got this error in console client.js:1039 Uncaught TypeError: net.connect is not a function at connectSocket (client.js:1039) at Backoff.<anonymous> (client.js:1203) at Backoff../node_modules/events/events.js.EventEmitter.emit (events.js:84) at Backoff../node_modules/backoff/lib/backoff.js.Backoff.onBackoff_ (backoff.js:53)
And when I call login function nothing return from bind function.
Anyone can help?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:7 (1 by maintainers)
Top Results From Across the Web
require('net').connect is not a function - Stack Overflow
Net is node.js (SSR) package and isn't available on the browser since the browser cannot open arbitrary TCP sockets.
Read more >How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript TypeError: "x" is not a function occurs when calling a function on a value or object, which is not actually a...
Read more >Errors | Node.js v19.3.0 Documentation
Indicates that a provided argument is not an allowable type. For example, passing a function to a parameter which expects a string would...
Read more >Klemen1337/node-thermal-printer - Gitter
Uncaught TypeError : net.connect is not a function. When I switched var net = require("net"); to var net = require("net-browserify"); on line 10, ......
Read more >Uncaught TypeError: net.connect is not a function -
Uncaught TypeError : net.connect is not a function ... I try to use ldapjs in my react app to do user authentification. Everything...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
got same error, any news about this?
EDIT:
you cant use ‘net’ module on client-side, it must be on server 😃
also caught this error in Vuejs project. Any fixe ?