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

283
Visualizações
Uncaught TypeError: exists is not a function

I have a logitech gaming steering wheel that I would like to send signals over the web to another peer. I am using PeerJS to establish this connection. When I run the code in a nodejs environment offline I am able to establish a connection with the steering wheel and extract signals.

However, when I tried to display the signals on the HTML console I would get an error that would say "require is not defined". To get rid of the "require is not defined" error, I used browserify to be able to use the logitech-g29 module on the web but it gave me the new error with "exists is not a function" in the browserify created js file.

How can I avoid this Uncaught TypeError when I try to establish a connection with the steering wheel? This error is called in the bundle.js file that's created from browserify.

Command Line code with browserify

browserify -r logitech-g29 -o bundle.js

sender.html

        <script src="https://unpkg.com/peerjs@1.3.1/dist/peerjs.min.js"></script>
        <script type="text/javascript" src="bundle.js"></script>
        <script type="text/javascript" src="main.js"></script>

main.js

(function () {
    const logitech = require('logitech-g29');
    var lastPeerId = null;
    var peer = null; // own peer object
    var conn = null;
    var recvIdInput = document.getElementById("receiver-id");
    var status = document.getElementById("status");
    var message = document.getElementById("message");
    var sendMessageBox = document.getElementById("sendMessageBox");
    var sendButton = document.getElementById("sendButton");
    var clearMsgsButton = document.getElementById("clearMsgsButton");
    var connectButton = document.getElementById("connect-button");

    function steeringWheel(){
        const options = {
        autocenter: true,
        range: 270
        }
        // This is where occurs below
        logitech.connect(options, function(err) {
        console.log('Ready')
        })
    }
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