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

545
Views
La actualización a angular-6.x da "Error de referencia no detectado: global no está definido"

Actualicé mi proyecto de angular-5.x a angular-6.x y comenzó a dar el siguiente error e incluso la creación de una variable global ficticia no funciona como se indica aquí Angular 6 Auth0 - global no definido

El error es el siguiente:

 Uncaught ReferenceError: global is not defined at Object../node_modules/has-binary2/index.js (index.js:10) at __webpack_require__ (bootstrap:81) at Object../node_modules/socket.io-parser/index.js (index.js:8) at __webpack_require__ (bootstrap:81) at Object../node_modules/socket.io-client/lib/index.js (index.js:7) at __webpack_require__ (bootstrap:81) at Object../src/app/app4pc/apiConnection/services/ApiConnectionServer.ts (auth.interceptor.ts:8) at __webpack_require__ (bootstrap:81) at Object../src/app/app4pc/apiConnection/toServer.module.ts (ApiConnectionServer.ts:11) at __webpack_require__ (bootstrap:81)

después de resolver esto me sale el siguiente error:

 Uncaught ReferenceError: process is not defined at Object../node_modules/process-nextick-args/index.js (index.js:3) at __webpack_require__ (bootstrap:81) at Object../node_modules/readable-stream/lib/_stream_readable.js (_stream_readable.js:26) at __webpack_require__ (bootstrap:81) at Object../node_modules/readable-stream/readable-browser.js (readable-browser.js:1) at __webpack_require__ (bootstrap:81) at Object../node_modules/simple-peer/index.js (index.js:7) at __webpack_require__ (bootstrap:81) at Object../src/app/util/services/call.services.ts (notification.service.ts:12) at __webpack_require__ (bootstrap:81)

Y sigue y sigue.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Agregar esta línea a polyfills.ts debería resolver el error global del nodo

(window as any).global = window;

La solución se mencionó en este tema angular-cli thred

over 4 years ago · Santiago Trujillo Report

0

Agregue el siguiente código en su página de inicio, por ejemplo, index.html

 var global = global || window; var Buffer = Buffer || []; var process = process || { env: { DEBUG: undefined }, version: [] };

Ejemplo:

 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Client</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> <script> var global = global || window; var Buffer = Buffer || []; var process = process || { env: { DEBUG: undefined }, version: [] }; </script> </head> <body> <app-root> <div class="loader"></div> </app-root> </body> </html>

Lo anterior funcionará en la aplicación híbrida (en el entorno Node), así como en el navegador

  • para "Error de referencia no capturado: global no está definido":

     var global = global || window;
  • para "Error de referencia no capturado: el búfer no está definido":

     var Buffer = Buffer || [];
  • para "Error de referencia no capturado: el proceso no está definido":

     var process = process || { env: { DEBUG: undefined } }
  • para "TypeError no capturado: no se puede leer la propiedad 'segmento' de indefinido":

     var process = process || { env: { DEBUG: undefined }, version: [] };
over 4 years ago · Santiago Trujillo Report

0

Uso HttpClient y accidentalmente seleccioné la importación predeterminada que era 'selenium-webdriver/http'

Si su app.module.ts ha import { HttpClient } from 'selenium-webdriver/http';

Actualícelo para import { HttpClient } from '@angular/common/http';

Eso solucionó mi problema.

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!