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.

Regression in 0.15.1 (when used in browser context)

See original GitHub issue

I triple-checked and everything else left alone 0.15.1 results in an error while 0.15.0 works, so this must be a regression.

The error happens when plugin manager is used in browser context (Electron renderer) and is thrown by this specific line:

https://github.com/davideicardi/live-plugin-manager/blob/881a95c8a0b5d1895d0d7c32855f2914e9419e6b/src/PluginVm.ts#L438

I’ll try to copy the exact error later, it’s about console.Console either missing or not being a constructor.

For now downgraded to 0.15.0.

New user here, nice work!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dianlightcommented, Jan 19, 2021

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

0reactions
dianlightcommented, Jan 26, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bountysource
Regression in 0.15.1 (when used in browser context )
Read more >
Measures of Model Fit for Linear Regression Models
Three statistics are used in Ordinary Least Squares (OLS) regression to evaluate model fit: R-squared, the overall F-test, and the Root Mean Square...
Read more >
The Least Squares Regression Method – How to Find the Line ...
What is the Least Squares Regression method and why use it? Least squares is a method to apply linear regression.
Read more >
A greedy regression algorithm with coarse weights offers ...
Regularized regression analysis is a mature analytic approach to identify weighted sums of variables predicting outcomes. We present a novel ...
Read more >
How To Interpret R-squared in Regression Analysis
Unbiased in this context means that the fitted values are not systematically ... Related posts: Understand Precision in Applied Regression to Avoid Costly ......
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