You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
I am building an electron app, but I am having trouble importing the "child_process" core module. Each of the follow result in a compile time "can't resolve 'child_process'" error (see error 1 below).
import * as childProcess from 'child_process';
import { exec } from 'child_process';
const exec: any = require('child_process').exec;
However, the following don't result in a compile time error, but it results in an uncaught type error at run time.
import { ipcRenderer, remote } from 'electron'; (see error 2 below)
import * as fs from 'fs'; (see error 3 below)
This workaround/hack works but 1) uses eval and 2) doesn't have type system support:
const exec: any = eval("require('child_process').exec");
const fs: any = eval("require('fs')");
const ipcRenderer: any = eval('require(\'electron\').ipcRenderer');
The log given by the failure.
Normally this include a stack trace and some more information.
Compile time error when importing "child_process."
ERROR in ./src/app/shared/services/shell.service.ts
Module not found: Error: Can't resolve 'child_process' in 'C:\path\to\app\shared\services'
@ ./src/app/shared/services/some.service.ts 10:0-46
@ ./src/app/shared/shared.module.ts
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
Run time error when importing "electron."
"Uncaught TypeError: fs.readFileSync is not a function"
When importing "fs"
Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_0_fs__.lstatSync is not a function
Mention any other details that might be useful.
Thanks! We'll be in touch soon.
The text was updated successfully, but these errors were encountered:
OS?
Windows 10 x64
Versions.
Repro steps.
I am building an electron app, but I am having trouble importing the "child_process" core module. Each of the follow result in a compile time "can't resolve 'child_process'" error (see error 1 below).
import * as childProcess from 'child_process';
import { exec } from 'child_process';
const exec: any = require('child_process').exec;
However, the following don't result in a compile time error, but it results in an uncaught type error at run time.
import { ipcRenderer, remote } from 'electron';
(see error 2 below)import * as fs from 'fs';
(see error 3 below)This workaround/hack works but 1) uses
eval
and 2) doesn't have type system support:const exec: any = eval("require('child_process').exec");
const fs: any = eval("require('fs')");
const ipcRenderer: any = eval('require(\'electron\').ipcRenderer');
The log given by the failure.
Mention any other details that might be useful.
The text was updated successfully, but these errors were encountered: