I am running into some kind of problem when attempting to build my ionic v1 project with jscrambler.
I am using an Apple MAC with the following config
MYMAC:ECTGW_Ionic admin$ ionic info
[WARN] Error with ./www/lib/ionic/version.json file: FILE_NOT_FOUND, trying ./bower.json.
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.15.2
ionic (Ionic CLI) : 3.15.2
global packages:
cordova (Cordova CLI) : 7.0.1
Gulp CLI : CLI version 3.9.1 Local version 3.9.1
local packages:
Cordova Platforms : ios 4.4.0
Ionic Framework : ionic1 1.3.4
System:
ios-sim : 5.0.13
Node : v6.11.5
npm : 3.10.10
OS : macOS Sierra
Xcode : Xcode 9.0.1 Build version 9A1004
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
Prior to adding jscrambler, my ionic project builds, runs, and deploys to iOS without any problem.
I donât know if it is relevant to state this or if this is in some way related to the current problem which is described below, but the ONLY way I could get ionic to install on my Apple Mac was to use the following method. Prior to finding a knowledge article showing the below installation method I was encountering nonstop error after error and couldnât get ionic installed.
1- Open a new command line window. Type in:
sudo npm install --global --unsafe-perm quickscrape
And hit enter.
Mac: You will need to type in your computer password on all commands beginning with âsudoâ
2- Then type in:
sudo npm install -g cordova ionic --unsafe-perm quickscrape
And hit enter.
3- Finally type in:
sudo npm install -g ionic --unsafe-perm node-sass
And hit enter.
Ionic should be installed now.
I am following the procedure here Protecting Hybrid Mobile Apps with Ionic and JScrambler and have also engaged JScrambler Support but they told me its a permissions issue and have not provided any specific troubleshooting help yet other than to point me at a few knowledge articles and answer some questions.
What I really need is troubleshooting help. Thatâs what I need.
Anyway, once I run the command ionic prepare and create the hooks/after_prepare/ this is the point where I start running into issues.
There is a file in the hooks/after_prepare/ folder by default named 010_add_platform_class.js and that executes without incident.
This tells me the problem is not permissions related because if it was a permissions issue, the 010_add_platform_class.js would have problems executing.
Never the less, when I plop the jscrambler.js file in the hooks/after_prepare/ folder and run ionic cordova build ios I get the following problem.
MYMAC:ECTGW_Ionic admin$ ionic cordova build ios
[WARN] Not performing Ionic build for project type: ionic1.
> cordova build ios
cordova-custom-config: Skipping auto-restore of config file backup(s)
Running command: /Users/admin/Desktop/ECTGW_Ionic/hooks/after_prepare/010_add_platform_class.js /Users/admin/Desktop/ECTGW_Ionic
add to body class: platform-ios
Running command: /Users/admin/Desktop/ECTGW_Ionic/hooks/after_prepare/jscrambler.js /Users/admin/Desktop/ECTGW_Ionic
Error: spawn EACCES
[ERROR] An error occurred while running cordova build ios (exit code 1).
I already tried this:
MYMAC:ECTGW_Ionic admin$ chmod +x hooks/after_prepare/010_add_platform_class.js
MYMAC:ECTGW_Ionic admin$ chmod +x hooks/after_prepare/jscrambler.js
And that doesnât fix my problem.
In fact ionic runs the following hook fine without incident.
hooks/after_prepare/010_add_platform_class.js
It just wonât run this hook
hooks/after_prepare/jscrambler.js
I also tried this:
MYMAC:ECTGW_Ionic admin$ ionic hooks add
[ERROR] Unable to find command: hooks add
MYMAC:ECTGW_Ionic admin$
MYMAC:ECTGW_Ionic admin$ ionic cordova hooks add
[ERROR] Unable to find command: cordova hooks add
MYMAC:ECTGW_Ionic admin$
Running it with sudo ends in the same result
MYMAC:ECTGW_Ionic admin$ sudo ionic hooks add
[ERROR] Unable to find command: hooks add
MYMAC:ECTGW_Ionic admin$
MYMAC:ECTGW_Ionic admin$ sudo ionic cordova hooks add
[ERROR] Unable to find command: cordova hooks add
MYMAC:ECTGW_Ionic admin$
I also tried this based on seeing some posts that claim removing platform iOS, then adding hooks, then re-installing platform iOS is the solution.
MYMAC:ECTGW_Ionic admin$ ionic cordova platform remove ios
MYMAC:ECTGW_Ionic admin$ ionic cordova hooks add
[ERROR] Unable to find command: cordova hooks add
MYMAC:ECTGW_Ionic admin$
MYMAC:ECTGW_Ionic admin$ ionic cordova platform remove ios
MYMAC:ECTGW_Ionic admin$ ionic hooks add
[ERROR] Unable to find command: hooks add
MYMAC:ECTGW_Ionic admin$
But I keep getting the message
[ERROR] Unable to find command: hooks add
Or
[ERROR] Unable to find command: cordova hooks add
I am at a complete loss as to why the build process ends in the following error
Error: spawn EACCES
[ERROR] An error occurred while running cordova build ios (exit code 1).
I am not a unix, linux, or mac expert. My background is in windows, so this mac development project with ionic is me taking a leap into the deep end of the ocean while trying to knit together a life vest so i donât drown.
My gut is telling me that the contents of the jscrambler.js file itself is the root of the problem, but I donât know enough about what it is supposed to contain to be able to troubleshoot it effectively.
I am hoping that someone here may have some experience with jscrambler and can provide some troubleshooting guidance so that I can determine what the actual problem is since jscrambler support is not yet helping me on that level.
I hope they will, but we didnât get there yet and I donât have time to waste.
Here is a copy of the jscrambler.js file with the critical key elements redacted for security.
#!/usr/local/bin/ node
var jscrambler = require('jscrambler').default;
jscrambler.protectAndDownload({
keys: {
accessKey: 'REDACTED FOR SECURITY',
secretKey: 'REDACTED FOR SECURITY'
},
host: 'api4.jscrambler.com',
port: 443,
applicationId: 'REDACTED FOR SECURITY',
filesSrc: [
'./www/*.{js,html}',
],
filesDest: './',
params: [
{
'name': 'whitespaceRemoval'
},
{
'name': 'duplicateLiteralsRemoval'
}
]
})
.then(function () {
console.log('All done!');
})
.catch(function (err) {
console.error(err);
});
If anyone here can help me troubleshoot this, I would be greatly appreciative.
Thanks so much in advance.