Header Ads Widget

Ticker

6/recent/ticker-posts

NodeJS: socksv5: Cómo corregir el error normalizeConnectArgs no es una función

Error de ejemplo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
dieciséis
[root@tutorialspots drive4]# node test.js
/home/drive4/node_modules/socksv5/lib/client.js:225
  var args = normalizeConnectArgs(arguments),
             ^
 
TypeError: normalizeConnectArgs is not a function
    at Agent.exports.connect.exports.createConnection (/home/drive4/node_modules/socksv5/lib/client.js:225:14)
    at Agent.createSocket (/home/drive4/node_modules/socksv5/lib/Agents.js:225:21)
    at Agent.addRequest (/home/drive4/node_modules/socksv5/lib/Agents.js:194:23)
    at new ClientRequest (_http_client.js:258:16)
    at request (http.js:42:10)
    at Object.get (http.js:46:13)
    at Object.<anonymous> (/home/drive4/test.js:10:6)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

¿Cómo arreglar este error?

Paso 1: retire el paquete socksv5

1
2
3
4
5
6
[root@tutorialspots drive4]# npm rm socksv5
npm WARN drive-m3u8-team@1.0.0 No description
npm WARN drive-m3u8-team@1.0.0 No repository field.
 
removed 21 packages and audited 141 packages in 0.946s
found 0 vulnerabilities

Paso 2: instale el paquete @luminati-io/socksv5

1
2
3
4
5
6
7
8
9
10
11
12
[root@CentOS-82-64-minimal drive4]# npm i @luminati-io/socksv5
npm WARN drive-m3u8-team@1.0.0 No description
npm WARN drive-m3u8-team@1.0.0 No repository field.
 
+ @luminati-io/socksv5@0.0.7
added 21 packages from 16 contributors and audited 162 packages in 3.414s
 
1 package is looking for funding
  run `npm fund` for details
 
found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

Paso 3: cambia el código

1
const socks = require('socksv5')

a:

1
const socks = require('@luminati-io/socksv5')

Paso 4: reinicia pm2 o para siempre

1
pm2 restart index

Publicar un comentario

0 Comentarios