Skip to content
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

NodeJS: SyntaxError: Unexpected identifier #50

Closed
LucasBrazi06 opened this issue Apr 28, 2017 · 39 comments
Closed

NodeJS: SyntaxError: Unexpected identifier #50

LucasBrazi06 opened this issue Apr 28, 2017 · 39 comments
Milestone

Comments

@LucasBrazi06
Copy link

Hi,

I obfuscated my whole NodeJS project with you Grunt task and when I want to run it I got this syntax error.

SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\Data\Private\Innovation\EV\ev-server\dist\client\soap\SoapChargingStationClient.js:1:6037)
at Module._compile (module.js:570:32)

I tried several other options (medium obfuscation, optimal performance...) without success.

I search a solution but found nothing.

Any clue?

Thanks,
Serge.

@sanex3339
Copy link
Member

Hi, can you provide more detailed error message? Also i will very happy if you send me small project with example of current problem, it help me to reproduce the error.

@LucasBrazi06
Copy link
Author

LucasBrazi06 commented May 1, 2017

Hi,

Find attached the part that fails.

Just rename the 'pdf' to 'zip' :-) - it does not accept ZIP file :( - and unpack it, do 'npm install' + 'grunt' to get the syntax error.

Thanks!
Serge.

src.pdf

@sanex3339
Copy link
Member

Tnx, i'll look at this right now

@sanex3339
Copy link
Member

How i can build dist files? grunt task grunt.registerTask("build:prod", ["clean", "uglify"]); without ["clean", "uglify"] doesn't generate dist folder

@sanex3339
Copy link
Member

It's a bug!

@sanex3339
Copy link
Member

I'll fix it soon as possible (today)

@sanex3339
Copy link
Member

sanex3339 commented May 2, 2017

javascript-obfuscator@0.9.3 out! Please update grunt-contrib-obfuscator to 3.0.0 version

@slig
Copy link

slig commented May 2, 2017

Since the grunt-contrib-obfuscator's package.json specified "javascript-obfuscator": "^0.8.1", it won't pull the new version of javascript-obfuscator because it's 0.9.x and not 0.8.x, I believe.

@sanex3339
Copy link
Member

Can you update it?

@slig
Copy link

slig commented May 2, 2017

Updated to a new version grunt-contrib-obfuscator@3.0.0.

@sanex3339
Copy link
Member

Thank you!

@slig
Copy link

slig commented May 2, 2017

You're welcome. I should've followed the same version number you use on your package. Would've been much easier to understand.

@qingweiqm
Copy link

qingweiqm commented May 3, 2017 via email

@qingweiqm
Copy link

qingweiqm commented May 3, 2017 via email

@qingweiqm
Copy link

qingweiqm commented May 3, 2017 via email

@sanex3339
Copy link
Member

Hmm, @qingweiqm, i slightly don't understand context of last three messages, can you describe it?

@qingweiqm
Copy link

qingweiqm commented May 3, 2017 via email

@sanex3339
Copy link
Member

I don't see any attached files, can you paste it here manually?

@qingweiqm
Copy link

qingweiqm commented May 3, 2017 via email

@sanex3339
Copy link
Member

sanex3339 commented May 3, 2017

strange, because i installed 0.9.3 version without any problems
image

@sanex3339
Copy link
Member

sanex3339 commented May 3, 2017

if you want to use new version of javascript-obfuscator with grunt-contrib-obfuscator, you should just update grunt-contrib-obfuscator to 3.0.0 version, javascript-obfuscator will install automatically as dependency of grunt-contrib-obfuscator

@qingweiqm
Copy link

qingweiqm commented May 3, 2017 via email

@LucasBrazi06
Copy link
Author

Hi,
I upgraded to the last version and still get the same error when running 'grunt build:prod'.
"grunt-contrib-obfuscator": "^3.0.0",
"javascript-obfuscator": "^0.9.3"

Cheers,
Serge.

@sanex3339
Copy link
Member

sanex3339 commented May 3, 2017

You don't need "javascript-obfuscator": "^0.9.3" line, just reinstall grunt-contrib-obfuscator:
npm uninstall grunt-contrib-obfuscator --save-dev
and install it again
npm i grunt-contrib-obfuscator --save-dev

Or you can type npm update and this command should update all your dependencies.
Or completely remove node_modules folder and type npm i

After that check your node_modules/escodegen-wallaby folder. This folder should exist.
Also check version in node_modules/javascript-obfuscator/package.json, it should be 0.9.3

@sanex3339
Copy link
Member

sanex3339 commented May 4, 2017

javascript-obfuscator@0.9.4 out. Added performance boost of the obfuscated code with stringArrayEncoding: 'rc4'

@LucasBrazi06
Copy link
Author

I did as you advised and checked the version, updated but still same compil issue since the beginning: SyntaxError: Unexpected token: name (ChargingStationClient)

@sanex3339
Copy link
Member

sanex3339 commented May 7, 2017

hmm, i'll look into this in a few days

@LucasBrazi06
Copy link
Author

And ? :-)

@sanex3339
Copy link
Member

I will look, but not now and not today =( Sorry, but today i haven't time for programming =(

@LucasBrazi06
Copy link
Author

No problem :-)

@sanex3339
Copy link
Member

sanex3339 commented May 11, 2017

I obfuscated both ChargingStationClient.js and SoapChargingStationClient.js without any problems (CLI with default options)

@sanex3339
Copy link
Member

Can you provide another example? In previous example grunt task didn't work at first, i edited gruntfile to run it.

@sanex3339
Copy link
Member

ping

@LucasBrazi06
Copy link
Author

pong :)

Sorry I'm on holiday and I'm going back soon.

I'll provide you another example.

Cheers!

@sanex3339
Copy link
Member

Ok

@sanex3339
Copy link
Member

ping :)

@sanex3339 sanex3339 added this to the 0.10.0 milestone May 31, 2017
@sanex3339
Copy link
Member

ping

@sanex3339
Copy link
Member

sanex3339 commented Jun 28, 2017

Closed due to inactivity. Please, create new ticket if necessary.

@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants