TypeError: object is not a constructor
See original GitHub issueI get that after i pack my electron app and running the exe. Any clue whats wrong?
My main.js:
require('bytenode');
require('./main.jsc');
How i use bytenode:
const bytenode = require('bytenode');
..
const modifiedFile = await bytenode.compileFile({
filename: './main.js'
});
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >Javascript "Not a Constructor" Exception while creating objects
The reason is that when it is attempting to initialize y, it creates a temporary "y" object (not class, object!) in the dependency...
Read more >Resolving TypeError: "X" is Not a Constructor in JavaScript
JavaScript "TypeError: "x" is not a constructor" errors occur when invalid objects or a variable is erroneously used as a constructor.
Read more >TypeError: "X" is not a constructor in JavaScript | bobbyhadz
To solve the "TypeError: 'X' is not a constructor" in JavaScript, make sure to only use the new operator on valid constructors, e.g....
Read more >JavaScript TypeError - "X" is not a constructor - GeeksforGeeks
This JavaScript exception is not a constructor that occurs if code tries to use an object or a variable as a constructor, which...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The issue lies in your new
testclass.js
file. You have to export your class again:Or, you can use
.jsc
directly from your “old”main.js
, i.e. change it to usetestclass.jsc
before compiling it:Or, if you delete the plain
.js
files, therequire
function will automatically use the.jsc
files, given that you have requiredbytenode
as you’ve already done in your first line.I also tried
Gives same error.