node-notifier icon indicating copy to clipboard operation
node-notifier copied to clipboard

Module Not Found Error on Angular + Electron project

Open astrO1 opened this issue 3 years ago • 1 comments

I'm installing a package from this GIT https://github.com/maximegris/angular-electron that is a starter project with Angular 10 + Electron 9.0

When I simple install you node-notifier with:

npm install --save node-notifier

And import this on my home.component.ts


import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Notifier } from 'node-notifier';



@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {

  constructor(private router: Router) { }

  ngOnInit(): void { }

  testeNotify() {
    setTimeout(() => {

      // String
      Notifier.notify('Message');

      // Object
      Notifier.notify({
        title: 'My notification',
        message: 'Hello, there!'
      });

And when I start my project it gives many errors like this:


ERROR in ./node_modules/node-notifier/lib/utils.js
Module not found: Error: Can't resolve 'child_process' in 'C:\xampp\htdocs\menap\menap_desktop\node_modules\node-notifier\lib'

ERROR in ./node_modules/growly/lib/gntp.js
Module not found: Error: Can't resolve 'crypto' in 'C:\xampp\htdocs\menap\menap_desktop\node_modules\growly\lib'

ERROR in ./node_modules/growly/lib/gntp.js
Module not found: Error: Can't resolve 'fs' in 'C:\xampp\htdocs\menap\menap_desktop\node_modules\growly\lib'

What I'm doing wrong?

astrO1 avatar Oct 10 '20 16:10 astrO1

I don't really know about the first problem because "child_process" is a native node js package. Maybe a reinstall of you're node modules folder (just delete the whole folder and run npm i) could solve this problem. It could also solve the problem with the other two (at least the last error because as far as I know "fs" is also a native package)

h110m avatar Nov 25 '20 00:11 h110m