Closed freeride-pawel closed 10 years ago
Hey, thanks for the feedback. Can you look if the plugin generated a file called ".sublime-grunt.cache" in the folder your Gruntfile is in? And if so, post it's contents? Thanks!
{"/home/.../public_html/Gruntfile.js":{"sha1":"446245db762a27e885bef3bb4dd3e65f376296bb","tasks":{"uglify":{"name":"uglify","info":"Minify files with UglifyJS.","meta":{"info":"\"grunt-contrib-uglify\" local Npm module","filepath":"/home/.../public_html/node_modules/grunt-contrib-uglify/tasks/uglify.js"},"multi":true,"targets":["my_target"]},"default":{"name":"default","info":"Alias for \"uglify\" task.","meta":{"info":"Gruntfile","filepath":"/home/.../public_html/Gruntfile.js"}}}}}
Seems not very malformed to me. Does your username/whatever is there instead of the ...
contain any special characters or spaces?
{"/home/www/kparts.com/public_html/Gruntfile.js":{"sha1":"446245db762a27e885bef3bb4dd3e65f376296bb","tasks":{"uglify":{"name":"uglify","info":"Minify files with UglifyJS.","meta":{"info":"\"grunt-contrib-uglify\" local Npm module","filepath":"/home/www/kparts.com/public_html/node_modules/grunt-contrib-uglify/tasks/uglify.js"},"multi":true,"targets":["my_target"]},"default":{"name":"default","info":"Alias for \"uglify\" task.","meta":{"info":"Gruntfile","filepath":"/home/www/kparts.com/public_html/Gruntfile.js"}}}}}
Nope, that is looking completely fine. I will include a bit more debugging output in the code later today. I will tell you when it's done.
Thanks a lot!
I got same issue:
Please file an issue on https://github.com/tvooo/sublime-grunt/issues and attach this output. SublimeGrunt: JSON is malformed
Mac OS 10.9 & Sublime Text 3 build 3047
SublimeGrunt.sublime-settings
{
"exec_args": {
"path": "/bin:/usr/bin:/usr/local/bin"
}
}
.sublime-grunt.cache
{"/Users/pleasurazy/Documents/www/twpocket.com/www/Gruntfile.js":{"sha1":"96d71ec91860f7b43c127e523e5f1eff39443479","tasks":{"clean":{"name":"clean","info":"Clean files and folders.","meta":{"info":"\"grunt-contrib-clean\" local Npm module","filepath":"/Users/pleasurazy/Documents/www/twpocket.com/www/node_modules/grunt-contrib-clean/tasks/clean.js"},"multi":true,"targets":["0"]},"coffee":{"name":"coffee","info":"Compile CoffeeScript files into JavaScript","meta":{"info":"\"grunt-contrib-coffee\" local Npm module","filepath":"/Users/pleasurazy/Documents/www/twpocket.com/www/node_modules/grunt-contrib-coffee/tasks/coffee.js"},"multi":true,"targets":["compile"]},"compass":{"name":"compass","info":"Compile Sass to CSS using Compass","meta":{"info":"\"grunt-contrib-compass\" local Npm module","filepath":"/Users/pleasurazy/Documents/www/twpocket.com/www/node_modules/grunt-contrib-compass/tasks/compass.js"},"multi":true,"targets":["dist"]},"jade":{"name":"jade","info":"Compile jade templates.","meta":{"info":"\"grunt-contrib-jade\" local Npm module","filepath":"/Users/pleasurazy/Documents/www/twpocket.com/www/node_modules/grunt-contrib-jade/tasks/jade.js"},"multi":true,"targets":["compile"]},"watch":{"name":"watch","info":"Run predefined tasks whenever watched files change.","meta":{"info":"\"grunt-contrib-watch\" local Npm module","filepath":"/Users/pleasurazy/Documents/www/twpocket.com/www/node_modules/grunt-contrib-watch/tasks/watch.js"},"targets":["compass","jade","coffee"]},"karma":{"name":"karma","info":"run karma.","meta":{"info":"\"grunt-karma\" local Npm module","filepath":"/Users/pleasurazy/Documents/www/twpocket.com/www/node_modules/grunt-karma/tasks/grunt-karma.js"},"multi":true,"targets":["e2e"]},"ngdocs":{"name":"ngdocs","info":"build documentation","meta":{"info":"\"grunt-ngdocs\" local Npm module","filepath":"/Users/pleasurazy/Documents/www/twpocket.com/www/node_modules/grunt-ngdocs/tasks/grunt-ngdocs.js"},"multi":true,"targets":["web_mgr"]},"default":{"name":"default","info":"Alias for \"watch\" task.","meta":{"info":"Gruntfile","filepath":"/Users/pleasurazy/Documents/www/twpocket.com/www/Gruntfile.js"}},"docs":{"name":"docs","info":"Alias for \"clean\", \"ngdocs\" tasks.","meta":{"info":"Gruntfile","filepath":"/Users/pleasurazy/Documents/www/twpocket.com/www/Gruntfile.js"}},"watch:compass":{"name":"watch:compass","info":"Targets watch:compass. Run predefined tasks whenever watched files change.","meta":{"info":"\"grunt-contrib-watch\" local Npm module"}},"watch:jade":{"name":"watch:jade","info":"Targets watch:jade. Run predefined tasks whenever watched files change.","meta":{"info":"\"grunt-contrib-watch\" local Npm module"}},"watch:coffee":{"name":"watch:coffee","info":"Targets watch:coffee. Run predefined tasks whenever watched files change.","meta":{"info":"\"grunt-contrib-watch\" local Npm module"}}}}}
@Pleasurazy
Sublime Text 3 build 3047 gives the same error on Windows. My patch addresses this without breaking. I actual upgraded to Sublime Text 3 just because I got the missing that SublimeLinter stopped supporting ST2. Gave me this error before I saw that people had problems with the previous fix for Windows.
Can you confirm that the issue was resolved by the latest patch?
@VirtueMe Should I add you as contributor? At the moment you do a lot more work on the plugin, and I always need some time to review your pull requests.
I'll be happy to be a contributor.
I installed Sublime Text 3 on another Linux virtual box, installed package control
, sublimelinter
and sublime-grunt
and everything worked just fine. So we need just someone else to confirm that this works.
Yesterday I updated this plugin with package control and got same issue as in first message “SublimeGrunt: JSON is malformed”, today I updated it again and ST3 just stopped responding after I tryed to run grunt from command palette, however it created .sublime-grunt.cache, here it is
{"D:\\_opens\\html\\rbk\\4talk-message\\Gruntfile.js":{"sha1":"56ea8ce7aecb2cf703c9c3b44bd1e0ae799c8eea","tasks":{"watch":{"name":"watch","info":"Run predefined tasks whenever watched files change.","meta":{"info":"\"grunt-contrib-watch\" local Npm module","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\node_modules\\grunt-contrib-watch\\tasks\\watch.js"},"targets":["less","sprite","imagemin"]},"cssmin":{"name":"cssmin","info":"Minify CSS files","meta":{"info":"\"grunt-contrib-cssmin\" local Npm module","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\node_modules\\grunt-contrib-cssmin\\tasks\\cssmin.js"},"multi":true},"uglify":{"name":"uglify","info":"Minify files with UglifyJS.","meta":{"info":"\"grunt-contrib-uglify\" local Npm module","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\node_modules\\grunt-contrib-uglify\\tasks\\uglify.js"},"multi":true},"concat":{"name":"concat","info":"Concatenate files.","meta":{"info":"\"grunt-contrib-concat\" local Npm module","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\node_modules\\grunt-contrib-concat\\tasks\\concat.js"},"multi":true},"less":{"name":"less","info":"Compile LESS files to CSS","meta":{"info":"\"grunt-contrib-less\" local Npm module","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\node_modules\\grunt-contrib-less\\tasks\\less.js"},"multi":true,"targets":["development","production"]},"imagemin":{"name":"imagemin","info":"Minify PNG and JPEG images","meta":{"info":"\"grunt-contrib-imagemin\" local Npm module","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\node_modules\\grunt-contrib-imagemin\\tasks\\imagemin.js"},"multi":true,"targets":["site","uploads"]},"sprite":{"name":"sprite","info":"Spritesheet making utility","meta":{"info":"\"grunt-spritesmith\" local Npm module","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\node_modules\\grunt-spritesmith\\tasks\\grunt-spritesmith.js"},"multi":true,"targets":["file_types"]},"ftp-deploy":{"name":"ftp-deploy","info":"Deploy code over FTP","meta":{"info":"\"grunt-ftp-deploy\" local Npm module","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\node_modules\\grunt-ftp-deploy\\tasks\\ftp-deploy.js"},"multi":true,"targets":["build"]},"browser_sync":{"name":"browser_sync","info":"Keep your browsers in sync","meta":{"info":"\"grunt-browser-sync\" local Npm module","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\node_modules\\grunt-browser-sync\\tasks\\browser-sync.js"},"multi":true},"default":{"name":"default","info":"Alias for \"sprite\", \"less\", \"imagemin\", \"browser_sync\", \"watch\" tasks.","meta":{"info":"Gruntfile","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\gruntfile.js"}},"_run":{"name":"_run","info":"Alias for \"sprite\", \"less\", \"imagemin\" tasks.","meta":{"info":"Gruntfile","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\gruntfile.js"}},"_ftp":{"name":"_ftp","info":"Alias for \"ftp-deploy\" task.","meta":{"info":"Gruntfile","filepath":"D:\\_opens\\html\\rbk\\4talk-message\\gruntfile.js"}},"watch:less":{"name":"watch:less","info":"Targets watch:less. Run predefined tasks whenever watched files change.","meta":{"info":"\"grunt-contrib-watch\" local Npm module"}},"watch:sprite":{"name":"watch:sprite","info":"Targets watch:sprite. Run predefined tasks whenever watched files change.","meta":{"info":"\"grunt-contrib-watch\" local Npm module"}},"watch:imagemin":{"name":"watch:imagemin","info":"Targets watch:imagemin. Run predefined tasks whenever watched files change.","meta":{"info":"\"grunt-contrib-watch\" local Npm module"}},"less:development":{"name":"less:development","info":"Targets less:development. Compile LESS files to CSS","meta":{"info":"\"grunt-contrib-less\" local Npm module"}},"less:production":{"name":"less:production","info":"Targets less:production. Compile LESS files to CSS","meta":{"info":"\"grunt-contrib-less\" local Npm module"}},"imagemin:site":{"name":"imagemin:site","info":"Targets imagemin:site. Minify PNG and JPEG images","meta":{"info":"\"grunt-contrib-imagemin\" local Npm module"}},"imagemin:uploads":{"name":"imagemin:uploads","info":"Targets imagemin:uploads. Minify PNG and JPEG images","meta":{"info":"\"grunt-contrib-imagemin\" local Npm module"}}}}}
Just before yesterday update everything worked like a charm. OS is Windows 8.1 x64, latest version of ST3
Can you confirm that you have two instances of ST3 open at the same time?
I get the same error when I open another instance of ST3.
Nope, I have only one instance of ST3 open all the time. I closed and reopened it a few times, trying to start Grunt before posting issue.
I wonder if I see what could be the problem, I try to fix this as soon as possible.
If there is some other info you need to know — I'd gladly provide it, thanks.
Thx, do you have sublimelinter installed?
Nope, but I do have this https://github.com/lunixbochs/sublimelint installed
Sorry, that was a sidetrack, could you confirm that you have grunt 0.4.0
installed?
It looks like we have a dependency on grunt 0.4.1
or higher, I'll try to investigate why that happened.
Not really, I have 0.4.2
version in node_modules
folder
I don't think the issue I found is related to your issue.
Which version of nodejs do you have?
node --version
It says v0.10.22
1 question more, do you kill ST3, I actually got it to finish the command. If you killed it, try to let it run for a while, ST3 will kill the subprocess as it creates a recursive loop and ST3 has a feature that will kill the loop after enough recursion.
I can't recreate the error I got before I upgraded grunt to version 0.4.2. Even when I revert back to 0.4.0. Strange.
I suspect that it might be a recursive loop because of the sha1 is not calculated correct. Try add the print function at line 53 in main.py
. The selected encoding of the Gruntfile.js
could tell us some more.
data = json.load(json_data)
print(filesha1) #--line 53
if data[gruntfile]["sha1"] == filesha1:
return data[gruntfile]["tasks"]
I didn't kill it before, but now I opened console and got a lot of this
File "D:\Web\Sublime3\Data\Packages\Grunt\main.py", line 59, in fetch_json
return self.run_expose()
File "D:\Web\Sublime3\Data\Packages\Grunt\main.py", line 40, in run_expose
return self.fetch_json()
File "D:\Web\Sublime3\Data\Packages\Grunt\main.py", line 59, in fetch_json
return self.run_expose()
File "D:\Web\Sublime3\Data\Packages\Grunt\main.py", line 40, in run_expose
return self.fetch_json()
File "D:\Web\Sublime3\Data\Packages\Grunt\main.py", line 59, in fetch_json
return self.run_expose()
File "D:\Web\Sublime3\Data\Packages\Grunt\main.py", line 34, in run_expose
(stdout, stderr) = expose.communicate()
File "X/subprocess.py", line 906, in communicate
File "X/subprocess.py", line 1166, in _communicate
File "X/threading.py", line 548, in __init__
File "X/threading.py", line 298, in __init__
RuntimeError: maximum recursion depth exceeded
As I thought. I will add a guard protecting us against that outcome.
Sorry, didn't noticed your edit of previous comment, gruntfile encoding is UTF-8 w/o BOM
Oooo nice one :D And one we should have seen in the code.
@DarkPreacher thx for all your help investigating this error, hopefully you can test the new version I pushed too. It will report the sha1 if they don't match. I added the guard, so we don't loop and put ST in an unresponsive mode.
Oh no, thank you for all the hard work. After update I got this, as you said
SublimeGrunt: JSON is malformed
Sha1 from grunt expose (adb0abc96bcadedcfcb1bcc2cb436d9b9df8e0ef) is not equal to calculated (3cb7306547477e3294548425c2c29c85bd3d8ff1)
Thx, have been wondering how to recreate this issue. I assume you use Cyrillic letters in your gruntfile.js
Thought I had to recreate you environment, but tried to use Norwegian letters in the file and suddenly I get the same error.
Added the norwegian special letters in the file and got the same issue. It should not last to long before we see the fix for this.
'* ÅæøCreated by: <%= _.pluck(pkg.maintainers, "name").join(", ") %>\n' +
When I added the letters Åæø
the sha1 differed.
Sha1 from grunt expose (3ba0bea333bcf3bdeb75f39aa32d4b1e8ff129d9) is not equal to calculated (677cebf855e3ba9f4604b0ea6ee07a446568f88c)
Hm-m-m… Yes, I do have cyrillic in my grunfile, but only as comments, will try to remove it
Yep, changed all comments to latin — works like a charm
Thx, that confirmed my suspicions. I have a fix ready, and it will be out in a little while. Sorry for the inconvenience.
The issue is related to that I in my first attempt was using two different methods for reading the file in python
and grunt/nodejs
. Raw vs string. Not using grunt to read the file solves the problem.
@DarkPreacher, if you can update and revert back to your original comments to verify the fix I'll be forever grateful.
Yes! I do confirm that everything works as it should. Thank you very much ツ
Thanks guys for figuring that out. Never thought it would be such a problem reading the file form two different interpreters.
I still have the problem, ST3 on Yosemite, latest version of package, grunt and node.
When select Grunt from quick panel an error shows "Could not read available tasks" - SublimeGrunt: JSON is malformed. When I run grunt in command line, then there are no errors. Here is Gruntfile.js