Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

399
Visualizações
Ssh tunnel Node.js to MongoDB

I have installed ssh2 in order to be able to connect from my Node.js server to MongoDB. First, when I run the code provided by documentation I take this Module not found: Error: Can't resolve 'cpu-features' in 'C:\Users\chris\Desktop\abot\node_modules\ssh2\lib\protocol' and this Module not found: Error: Can't resolve './crypto/build/Release/sshcrypto.node' in 'C:\Users\chris\Desktop\abot\node_modules\ssh2\lib\protocol' With a little resarch I understand that this module not found errors are for optional modules and do not have some impact. Second, I am trying to connect with this code provided by the documentation:

const { Client } = require('ssh2');

const conn = new Client();

conn.on('ready', () => {
    console.log('Client :: ready');
    conn.forwardOut('my local ip', 8000, '127.0.0.1', 27017, (err, stream) => {
      if (err) throw err;
      stream.on('close', () => {
        console.log('TCP :: CLOSED');
        conn.end();
      }).on('data', (data) => {
        console.log('TCP :: DATA: ' + data);
      }).end([
        'HEAD / HTTP/1.1',
        'User-Agent: curl/7.27.0',
        'Host: 127.0.0.1',
        'Accept: */*',
        'Connection: close',
        '',
        ''
      ].join('\r\n'));
    });
  }).connect({
    host: 'ip of the mongo server',
    port: ssh port,
    username: 'my user name',
    password: 'my password'
  });

Let me note that the server is configured to connect without providing the public key. When I am running the code, I take these messages: Client :: ready TCP :: CLOSED

Note number 2. I can connect with ssh tunnel through python, but now I need to connect through node also but without results.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda