Git Product home page Git Product logo

Comments (6)

dianlight avatar dianlight commented on June 1, 2024 1

The problem is the assumption that the current console object is the NodeJS object. For example if you use a log framework as electron-log the Console costructor don't exists.

A simple patch ( work in my case ) is:

@@ -435,7 +437,12 @@ export class PluginVm {
 			sandbox.process = Object.create(srcGlobal.process || null);
 		}
 		if (!sandbox.console) {
-			sandbox.console = new console.Console({ stdout: process.stdout, stderr: process.stderr });
+			if(console.Console){
+				sandbox.console = new console.Console({ stdout: process.stdout, stderr: process.stderr });
+			} else {
+				const { Console } = require('console');
+				sandbox.console = new Console({ stdout: process.stdout, stderr: process.stderr });
+			}
 		}
 
 		// override the global obj to "unlink" it from the original global obj

from live-plugin-manager.

davideicardi avatar davideicardi commented on June 1, 2024

Can you try to execute that on your environment?

console.Console({ stdout: process.stdout, stderr: process.stderr }); 

As described here: https://nodejs.org/docs/latest-v12.x/api/console.html#console_new_console_stdout_stderr_ignoreerrors

I suspect that console is not available in Electron or something similar. I'm not expert about Electron. Which node version are you using? Electron uses a built-in version?

thanks

from live-plugin-manager.

strogonoff avatar strogonoff commented on June 1, 2024

I believe latest Electron bundles Node 12.16.3. Thanks, I’ll look into it

from live-plugin-manager.

davideicardi avatar davideicardi commented on June 1, 2024

Thanks @dianlight ! Do you want to create a PR?

from live-plugin-manager.

davideicardi avatar davideicardi commented on June 1, 2024

It would be great to have some sort of unit test or example to reproduce this problem...

from live-plugin-manager.

dianlight avatar dianlight commented on June 1, 2024

@davideicardi now I don’t have much time. I will see what I can do.

from live-plugin-manager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.