12

I just installed Web Essentials in Visual Studio Premium 2013 in order to use LESS css. I renamed my Site.css into Site.less, save and I get Compilation Error occurred (see error list to navigate to the error location):

On the error list: Error 1 RTLCSS: Exception occured: Cannot call method 'toJSON' of undefined Site.less

I am totally new to less and have no idea what the error could be referring to. I have followed some getting started with less in visual studio tutorials and I believe I am not missing any step.

Thanks for your help!

enter image description here

nest
  • 1,385
  • 1
  • 15
  • 34
  • possible your `site.less` contains invalid CSS syntax? See also: http://lesscss.org/functions/#string-functions-e. Are you able to post the contents of that file? Or test your setup with a more simple less file? – Bass Jobsen Nov 26 '14 at 08:39
  • Start with just one simple class in your `less` file and see if that compiles. If it does build on it and recompile. Add, compile, repeat... – Colin Bacon Nov 26 '14 at 16:47
  • I just downloaded Web Essentials, and get the exact same error when I rename my css files to less. – brinch Nov 26 '14 at 23:58
  • I am getting the very same error after I renamed a very simple .css (h1 { color: red; }) to .less. I have Web Essentials 2.5.3 installed. – Alexander Christov Nov 27 '14 at 07:17
  • One workaround seems to be killing the *Node.exe* process using Task Manager (the task has the description 'Event I/O for V8 Javascript'. For more details see: https://github.com/madskristensen/WebEssentials2013/issues/1728#issuecomment-70397162 – user2466466 Apr 17 '15 at 12:06

3 Answers3

15

The method that worked for me is to close the file and reopen it from the solution explorer. Just by renaming the file and trying for it to compile does not work for some reason.

Girish Rao
  • 151
  • 3
  • This is what worked for me. I already had the latest Web Essentials 2013 Update 4 installed. – EthR Feb 05 '15 at 04:05
  • 1
    Same here - already had Update 4 installed and still got this error - definitely a bug that's not been fixed. I trigged this bug renaming a .css file to .less, something that's worked plenty of times before, but failed here. Closing VS and reopening fixed it. – Chris Moschini Feb 16 '15 at 16:10
  • Same here, had update 4 for vs2013 and 2.5.4 for web essentials. close and reopen fixed it. – JP Hellemons May 12 '15 at 12:52
  • Right, version of WE seems irrelevant - the chosen answer probably works because it triggers some kind of file reload as a side effect of updating WE. I still ran into this issue when renaming a css file to .less with WE 2.6.36. Just closing the file and reopening it from solution explorer seems to be the most direct solution. – Sean Mar 19 '16 at 16:20
3

I found the same bug, running Web Essentials 2.5.2 in VS 2013 Update 4.

Solved by upgrading to WE 2.5.3 for Update 4.

Dmitry
  • 16,110
  • 4
  • 61
  • 73
  • I also use WE 2.5.3 if you've read carefully the comments. So, it seems, the upgrade is not a solution. – Alexander Christov Nov 27 '14 at 14:39
  • Indeed now it works (more or less). Some files still show the compilation error and I had to create new less files for them instated of renaming the existing css. Moreover, I sometimes get a message like `myless.less could not be found in your workspace, or you do not have permission to access it.` when I save (but it saves anyway). Thanks, at least now I can use less – nest Nov 28 '14 at 08:02
  • 1
    Try remove and re-add `.less` file (only less) to solution and recreate depending ones. I noticed (via diff on .cproj) change in linked files hierarchy. `site.min.css` file was nested directly under `site.less`, but after upgrade it nested under `site.css` – Dmitry Nov 28 '14 at 08:13
0

I had already installed Web Essentials update 4 (e.g. v2.5.3), but still had this issue. For me it was solved after then also installing update for the 'Visual Studio Extensions for Windows Library for Javascript' extension (for x2? hey, I didn't name it :) (to version 1.0.9200).

I did not install this original extension, but I think it was automatically added by installing the Visual Studio 2013 update (I am now at VS2013 4.5.51641). The extension itself was then still an update behind or something.

Bart
  • 5,065
  • 1
  • 35
  • 43