-
-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_third_party_main.js:12 throw 'Invalid Nexe binary' ^ Invalid Nexe binary #372
Comments
This is expected behavior.. Don't use |
Hey!
Then I get a message that I should use --build --empty I'm going to try tomorow if this work. |
Haha Whoops. Thanks |
I'd also suggest using a maintained version of node :) |
No problem! Yeah, I'll do when I got time. :) Thanks! |
Fixed in |
I got this same error when I signed the executable and then tried to run it. Is there a way to sign the executable? |
@twmarr can you share your signed executable? Its actually truncating the file, so you won't be sharing any of your application code/functionality. |
@twmarr You could make a patch like the following, the resulting executable (slow build) should allow signing. require('nexe').compile({
build: true,
input: './app.js',
patches: [
(x, next) => {
x.code = () => [x.shims.join(''), x.input].join(';')
return next()
},
(compiler, next) => {
return compiler.setFileContentsAsync(
'lib/_third_party_main.js',
compiler.code()
).then(next)
}
]
}) Note: resources won't work |
@calebboyd |
@twmarr Did that work for you? |
@calebboyd I am getting an error: async (compiler, next) => { SyntaxError: Unexpected token ( |
@twmarr I updated the example, removing async await |
Ah, I am using 6.11.3 |
@calebboyd Sorry I didn't get back yesterday and I do appreciate your help. I had a problem with my environment and realized I needed to Install Nexe locally and not globally. Anyway, It did not work. After signing the executable, It still gives me this error when I run it: |
Hmm. That shouldn't be possible. If you clear out the temp directory |
@calebboyd That got me past that error, but I am using a global.require for the configuration since I do not want it bundled and it can't find it. Anyway...thanks for the help. I'm out until after Jan 1. Happy Holidays! |
@calebboyd Is there a reason that global.require wouldn't work using the patch? I am testing it before signing and when running, the file I am trying to global.require is created and exists, but I get No such native module when on the global.require line. The reason for the global require is so that I don't include the configuration in the exe so that the configuration can be changed later. |
Ahh Sorry @twmarr. Fusebox is responsible for global.require. It must have broken transiently... That is very frustrating... Alternatively you can prepend any code you like to the call to so you can do |
I run into the same issue after using signtool on Windows. This is the patch I created locally, currently it runs on the nexe dir after
Many thanks for answers. diff --git a/boot-nexe.js b/boot-nexe.js
index 2eed93b61..5af138e69 100644
--- a/boot-nexe.js
+++ b/boot-nexe.js
@@ -2,14 +2,23 @@
var fs = require('fs');
var fd = fs.openSync(process.execPath, 'r');
var stat = fs.statSync(process.execPath);
-var footer = Buffer.from(Array(32));
-fs.readSync(fd, footer, 0, 32, stat.size - 32);
-if (!footer.slice(0, 16).equals(Buffer.from('<nexe~~sentinel>'))) {
- throw 'Invalid Nexe binary';
+// need to find the real nexe footer for validation, but the
+// signing process adds extra bytes to the end of the file
+var tailSize = 16000;
+if(tailSize > stat.size) {
+ tailSize = stat.size;
}
+var tailBuf = Buffer.from(Array(tailSize));
+fs.readSync(fd, tailBuf, 0, tailSize, stat.size - tailSize);
+var sentinelPos = tailBuf.indexOf('<nexe~~sentinel>');
+if(sentinelPos == -1) {
+ throw 'Invalid Nexe binary';
+}
+var endNexeContent = stat.size - tailSize + sentinelPos + 32;
+var footer = tailBuf.slice(sentinelPos, sentinelPos+32);
var contentSize = footer.readDoubleLE(16);
var resourceSize = footer.readDoubleLE(24);
-var contentStart = stat.size - 32 - resourceSize - contentSize;
+var contentStart = endNexeContent - 32 - resourceSize - contentSize;
var resourceStart = contentStart + contentSize;
Object.defineProperty(process, '__nexe', (function () {
var nexeHeader = null; |
I ran into the same issue on windows when digital signing a nexe binary |
Wow I never saw this comment on this issue. Great Find @tamasszarka. Thanks for the PR @foxever |
I have also same issue |
I am having the same issue after signing the exe |
This is a
If this is a bug report, What are the steps to reproduce?
When I'm trying to run executeableFile.exe then I get a error:
Please also provide:
I'm abled to execute "node index.js"
The text was updated successfully, but these errors were encountered: