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

256
Views
Notificación - Error electrónico - _crypto.default.randomFillSync no es una función

Intento usar notificar en mi proyecto de electrones en el servidor de nodos. Así que instalé el módulo notificador de nodos en la carpeta de mi aplicación usando el siguiente comando.

 $ npm install --save node-notifier

Después de eso, agrego un botón a mi página web para mostrar el mensaje de notificación.
Cuando el usuario hace clic en el botón, se ejecuta el siguiente método js:

 <script type = "text/javascript"> const notifier = require('node-notifier') const path = require('path'); document.getElementById('notify').onclick = (event) => { notifier.notify ({ title: 'My awesome title', message: 'Hello from electron, Mr. User!', icon: path.join('','images/images.png'), // Absolute path (doesn't work on balloons) sound: true, // Only Notification Center or Windows Toasters wait: true // Wait with callback, until user action is taken against notification }, function (err, response) { // Response is response from notification }); notifier.on('click', function (notifierObject, options) { console.log("You clicked on the notification") }); notifier.on('timeout', function (notifierObject, options) { console.log("Notification timed out!") }); } </script>

Pero cuando hago clic en mi botón de notificación, aparece el siguiente error:

 Uncaught TypeError: _crypto.default.randomFillSync is not a function rng @ Project\MyElectronProject\node_modules\uuid\dist\rng.js:19 v4 @ Project\MyElectronProject\node_modules\uuid\dist\v4.js:17 getPipeName @ Project\MyElectronProject\node_modules\node-notifier\notifiers\toaster.js:51 notifyRaw@ Project\MyElectronProject\node_modules\nodenotifier\notifiers\toaster.js:60 document.getElementById.onclick @notification_index.html:16

El error anterior arroja la función rng en rng.js.

 function rng() { if (poolPtr > rnds8Pool.length - 16) { debugger; _crypto.default.randomFillSync(rnds8Pool); poolPtr = 0; }

El método randomFillSync no existe. No puedo entender este error, ¿ha encontrado este error antes? Gracias por tus sugerencias.

versión de nodo que usé en mi proyecto: v16.13.1

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

node-notifier es un módulo nodejs, no se puede usar en el script del navegador.

Creo que debería llamar al notificador de nodos en el proceso principal y luego comunicarse desde un proceso de representación al proceso principal.

Consulte: https://www.electronjs.org/docs/latest/api/ipc-renderer

about 4 years ago · Juan Pablo Isaza 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!