I am doing an easy test to try to get my computer's name in an Electron app using Angular and nodejs.
This is my script:
import { Component, OnInit } from '@angular/core';
import { hostname } from 'os'
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
constructor() { }
ngOnInit(): void {
console.log(hostname);
}
}
I also installed npm i @types/node
I get the following error:
Error: src/app/components/home/home.component.ts:2:26 - error TS2307: Cannot find module 'os' or its corresponding type declarations. import { hostname } from 'os'
Any ideas? this should be straightforward and I feel so silly with such a problem...
Edit: I added that this is an electron app!!