question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using fs, path and child_process only possible in background.ts

See original GitHub issue

I instaled vue with latest version of vue-cli and npm, chose typescript and added the builder. I tried to import child_process from the helloWorld component but on riuntime it is an empty object. In the background.ts it works. For some reason vscode tells me that ther is no electron-devtools-installer (in background.ts). But it throws no error. this is the working import in background.ts import * as child from 'child_process'; console.log(child); Do I have to pass the variable in some way to the vue app?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nklaymancommented, Oct 29, 2020

You will have to enable nodeIntegration to use native node modules in the renderer process. Please try that and let me know if it works.

0reactions
mchkirschcommented, Nov 30, 2020

For security reason I created a preload.js in between of the background.js and the renderer (VUE component). While sending messages with IPC ExampleComponent.vue --> Preload.js --> background.js just works fine, I can’t get a simple console.log() statement out of the preload.js. It always appears directly in the chromium browser console but should appear in the normal terminal (or VUE UI).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to wait for a child process to finish in Node.js
This is a better answer. You should avoid blocking (synchronous) code in Node wherever possible - it halts your entire program whilst waiting...
Read more >
How To Launch Child Processes in Node.js - DigitalOcean
In this tutorial, you will create child processes while executing a series of sample Node.js applications. You'll create processes with the ...
Read more >
Child process | Node.js v19.3.0 Documentation
By default, child_process.fork() will spawn new Node.js instances using the process.execPath of the parent process. The execPath property in the options object ...
Read more >
Module not found: Can't resolve 'child_process' #192 - GitHub
I'm using Node v6.11.2 and the code is copy-paste from the examples. Any ideas? I tried manually instaling the dependencies, because I noticed ......
Read more >
Worker Threads with TypeScript - Node.js TypeScript #12
const path = require('path');. require('ts-node').register() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found