Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
Why does the import of a package (mongoose) lead to a ReferenceError in ReactJS?

When trying to run the following code in ReactJS, I get the following error: Uncaught ReferenceError: process is not defined. If I remove the const mongoose = require('mongoose'); line, everything works well. It's worth noting that I have installed mongoose using the npm i mongoose command (version 6.3.1).

import logo from "./logo.svg";
import React, { Component } from 'react';
import "./App.css";
const mongoose = require('mongoose');

export default class Test extends React.Component {

        render() {
                return (
                        <div>
                                <p>Hey StackOverflow!</p>
                        </div>
                );
        }
}

What is the cause of this problem? Is it a problem with the mongoose package specifically?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Why do you need mongoose in your frontend code in the first place? To answer your question specifically: mongoose is using the global process variable which is only available in a NodeJS context (e.g. a backend server application), not Browser context.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda