stephenmathieson / node-obfuscator

maintainer wanted → Obfuscate your node packages because your boss says so!
216 stars 36 forks source link

Can't require packages #10

Closed Fusl closed 10 years ago

Fusl commented 10 years ago

Hi,

when obfuscating my script which works pretty well, this is what happens:

fusl@thinkbook:~/nodecast> ./transcoder2.js < transcoder.json

/home/fusl/nodecast/transcoder2.js:2
a("\x2e\x2f"+c.basename(b));if(d=c.resolve(b),e=c.cache[d],!e)throw Error('fai
                                                                    ^
Error: failed to require "./functions.js"
    at Error (<anonymous>)
    at c (/home/fusl/nodecast/transcoder2.js:2:160)
    at b (/home/fusl/nodecast/transcoder2.js:2:735)
    at Object.<anonymous> (/home/fusl/nodecast/transcoder2.js:2:986)
    at c (/home/fusl/nodecast/transcoder2.js:2:229)
    at /home/fusl/nodecast/transcoder2.js:2:15340
    at Object.<anonymous> (/home/fusl/nodecast/transcoder2.js:2:15406)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

And this is what it should look like:

fusl@thinkbook:~/nodecast> ./transcoder.js < transcoder.json
27 Nov 13:13:26 - Spawning mount(/main-192.mp3)
27 Nov 13:13:26 - Spawning mount(/main-192.mp3)
27 Nov 13:13:26 - Spawning mount(/main-128.mp3)
27 Nov 13:13:26 - Spawning mount(/main-128.mp3)
27 Nov 13:13:26 - Spawning mount(/main-128.aac)
27 Nov 13:13:26 - Spawning mount(/main-128.aac)
27 Nov 13:13:26 - Spawning mount(/main-64.aac)
27 Nov 13:13:26 - Spawning mount(/main-64.aac)
27 Nov 13:13:26 - Spawning source(dj)
27 Nov 13:13:26 - Spawning source(playlist)
27 Nov 13:13:26 - Spawning source(silence)

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1039:14)
    at listen (net.js:1061:10)
    at net.js:1135:9
    at dns.js:72:18
    at process._tickCallback (node.js:415:13)

// Edit: I compiled with

obfuscator --out transcoder3.js --strings --entry transcoder2.js ./transcoder2.js
stephenmathieson commented 10 years ago

you need to include all of your scripts, not just the entry point. for example:

obfuscator --out transcoder3.js --strings --entry transcoder2.js ./transcoder2.js ./functions.js ./lib/*.js
Fusl commented 10 years ago

Okay, that worked for me. Thanks!