Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.1K
Views
Node.js ssh2-sftp-client Error: fastPut: No hay respuesta del servidor Local

Estoy usando node -v v14.17.0 y "ssh2-sftp-client": "^7.0.0" y el método fastPut https://github.com/theophilusx/ssh2-sftp-client#sec-5-2-9

Verificar los archivos remotos está bien, por lo que la conexión funciona.

Mi entorno es wsl2 Ubuntu-20.04

El problema al que me enfrento es un error.

 RuntimeError: abort(Error: fastPut: No response from server Local: /home/draganddrop/testi.txt Remote: Downloads/testi.txt). Build with -s ASSERTIONS=1 for more info. at process.J (/home/draganddrop/node_modules/ssh2/lib/protocol/crypto/poly1305.js:20:53) at process.emit (events.js:376:20) at processPromiseRejections (internal/process/promises.js:245:33) at processTicksAndRejections (internal/process/task_queues.js:96:32)

También probé con sftp> put /home/draganddrop/testi.txt Downloads/testi.txt desde la consola, que funciona.

Código que estoy usando:

 let Client = require('ssh2-sftp-client'); let sftp = new Client(); let remotePath = 'Downloads/testi.txt'; let localPath = '/home/draganddrop/testi.txt' const config = { host: 'XX.XX.XXX.XXX', port: '22', username: 'XXXXX', password: 'XXXXXX' }; sftp.connect(config) .then(() => { sftp.fastPut(localPath, remotePath); //return sftp.exists(remotePath); }) //.then(data => { // console.log(data); // will be false or d, -, l (dir, file or link) //}) .then(() => { sftp.end(); }) .catch(err => { console.error(err.message); });

No tengo idea de qué causa este error, lo intenté con diferentes rutas y obtuve un error de ruta incorrecta o esto. ¿Qué podría ser la causa?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

El motivo del problema es que la conexión se cierra antes de que finalice la ejecución de fastPut .
Está ejecutando connect, después de eso en el primer .then , el método fastPut se ejecuta de forma asíncrona, no espera a que finalice la ejecución y regresa indefinido al siguiente método .then de la cadena.
Para resolver el problema, solo necesita devolver una promesa recibida de fastPut

 sftp.connect(config) .then(() => sftp.fastPut(localPath, remotePath)) .then((data) => {/* do something*/} .finally(() => sftp.end())
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!