Installing the correct environment for Angular with Compass and all other Node dependencies - ruby

I am just trying to make a local development environment that isn't on my work computer, and I keep getting an error:
Warning: Errno::ENOENT on line 441 of /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb: No such file or directory - /Users/johnpett/Desktop/Node/app/bower_components
Run with --trace to see the full backtrace Use --force to continue.
I have installed all the Ruby parts and Yeoman to build the app scaffold, but I can't seem to run the 'grunt server' command without throwing up this error.

The error is quite clear, a grunt-plugin require that file...
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb
Anyway ruby components are needed usually if you plan to use compass, if not, you can comment the "compass" sub-task in the "server" task in Gruntfile.js

Your folder was surely not called bower_components at that time. I guess you used yeoman.
In your compass task config you should have modified bower_components.

Related

Source map error when attempting to run grunt server

I'm unable to access my sass files when running grunt server. Not sure if this is just a file path/permission error or something greater.
Running sudo grunt server gives the same output
grunt server
Running "server" task
Running "clean:dist" (clean) task
Running "copy:video_fonts" (copy) task
Copied 4 files
Running "copy:video_js" (copy) task
Copied 1 files
Running "concurrent:dist" (concurrent) task
Warning: Error: Error generating source map: couldn't determine public URL for the source stylesheet.
No filename is available so there's nothing for the source map to link to.
on line of standard input
Use --trace for backtrace. Use --force to continue.
Aborted due to warnings.
%
I get the following error in my browser when I run grunt server --force
Sass::SyntaxError: Error generating source map: couldn't determine public URL for the source stylesheet.
No filename is available so there's nothing for the source map to link to.
I had the same problem on a grunt task that was perfectly working a couple of days ago. I suppose the problem was in some misalignment between the modules for that project (specifically grunt-contrib-sass) and the version of SASS installed.
I solved the problem by upgrading SASS, removing the node_modules folder inside my project and re-installing them.
I am sorry I cannot provide you any reason why it worked, but it did.
Update:
$ rm -R node_modules
$ npm install
Try:
$ grunt --debug --verbose sass
To get more info about what's happening while grunt runs.
S.

grunt compass Error: invalid option --sourcemap

i run grunt dev and get the error:
Running "compass:dev" (compass) task
Error: invalid option: --sourcemap
Don´t know why :(
Don´t even know how i could run compass without the option ... found nothing in the gruntfile.
thanks for help, i´m new with grunt/compass/sass
Execute "gem list" so we can have more details on what gem versions you're using.
AFAIK the sourcemap works since sass 3.3 and up.
If you want to disable the sourcemap on your project, check your config.rb file and check the sass_options entry, you might find ":sourcemap => true". If you find it, remove it and check it out.
Hope it helps!
This happens because of old version of SASS (or COMPASS, if you are using it) ruby gems which do not support sourcemap options.
Update these with following commands:
gem update sass
gem update compass <= if applicable
This should resolve the issue.

Sass Breakpoint causing Grunt error

Just did a fresh install on my MacBook with Mavericks. I'm using Yeoman and grunt to compile my project. After reinstalling and pull down the code from the repo, I see this error:
Warning: LoadError on line ["55"] of /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:
cannot load such file -- app/bower_components/compass-breakpoint/lib/breakpoint
Run with --trace to see the full backtrace Use --force to continue.
I'm requiring Breakpoint in my gruntfile.js. If i remove the require, everything compiles as expected, without errors.
Let me know if I can provide any more details. Thanks
So the error appears to be caused by you not pointing to the correct file (that's what the cannot load such file error means), so double check that your import path is correct, but at the moment, you must use Breakpoint through Ruby Compass as it requires a bit of Ruby code in order to function properly. With Sass 3.3 available, this Ruby dependency goes away Breakpoint gets updated, but it will require a compiler compatible with Sass 3.3 (libsass, what powers grunt-sass, is not compatible with Sass 3.3, for instance).
I would encourage you to use grunt-contrib-compass, use Bundler to manage Ruby version dependencies, and compile through Ruby Compass. These steps should resolve your issues.
Would suggest to go with NPM breakpoint. For installing:
npm install breakpoint-sass & add require 'breakpoint' in your config.rb file.

Using compass with Yeoman project, but outside of Yeoman server

I'm circumventing the built-in Yeoman server and severing files directly from the /app directory. Since Yeomen's server manages compass/sass compliation I'm having a hard time running compass outside of it. Running the compass cli directly doesn't work; it's not aware that it's in an existing compass project. So I get:
$ compass watch /app (or /app/styles)
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Has anybody had experience getting this to work?
You have to move your Compass settings out into a config.rb file to use the Compass CLI.
However, you can easily run the Compass grunt task individually like so grunt compass to compile, or grunt watch to automagically compile on file changes.

Error with Compass polling on windows 7

I am attempting to work locally on a PHP application which I cloned from the Git repository my partner and I use.
He uses a Mac, and until now I have been working on the app in a virtual Ubuntu Linux environment. Both environments have been able to use Compass polling with the same file structure and files.
On Windows 7, I run Compass commands from Cygwin, and this is the command I use to have Compass poll from the root directory of the app (C:/wamp/www/application):
compass watch --trace src/Application/ApplicationBundle/Resources/compass/
When I then make a change to a .scss file, I receive the following error:
ArgumentError on line 716 of /usr/lib/ruby/1.8/pathname.rb: different prefix: "/
/cygdrivecwampwwwlimelightsrclimelightlimelightbundleresourcescompasssrcpartials
_object.scss" and "/cygdrive/c/wamp/www/limelight/src/limelight/limelightbundle/
resources/compass/src"
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:81:in 'split_path'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:69:in 'run_callback'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:55:in 'callback_action'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:35:in 'update'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:39:in 'modified'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:37:in 'each'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:37:in 'modified'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:18:in 'refresh'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'each'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:15:in 'loop'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:15:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/monitor.rb:26:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm.rb:20:in 'monitor'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/watch_project.rb:86:in 'perform'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/base.rb:18:in 'execute'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/project_base.rb:19:in 'execute'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/exec/sub_command_ui.rb:43:in 'perform!'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/exec/sub_command_ui.rb:15:in 'run!'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:25
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:39:in 'call'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:39
/usr/bin/compass:19:in 'load'
/usr/bin/compass:19
All I've been able to find through searching is that it may have something to do with the fact that Windows capitalizes its drive names, although the lack of slashes in the returned path makes me think the problem may be elsewhere.
Does anyone know why I might receive this error in Windows, but not other platforms?
NOTE: I have found a work-around involving installing ruby (and compass) through Windows' command prompt rather than Cygwin, and that should work fine for now. Still, if anyone has ideas, I'm still curious as to what the problem could be.
According to this commit, this is a problem caused by a compass dependency called FSSM. It is used to monitor file changes in compass. A workaround is described in this comment.
It seems that FSSM detects that ruby is running inside a Windows box, and treats paths in the Windows' way (C:\blabla). Commenting out the line 26 of the file <fssm_gem_path>/lib/fssm/pathname.rb makes compass watch work as expected. You can also add
unless path[0, 1] == File::SEPARATOR
to the end of line 26 to make it work.
I thought I'd just provide a little more info to help people find the pathname.rb file.
On the cygwin prompt type:
gem env
This (unsurprisingly) brings up a load of info about your Ruby Gems installtion. Look for the line which specifies the INSTALLATION DIRECTORY. Mine was:
/usr/lib/ruby/gems/1.8
Now in Windows Explorer navigate to this location but substitute "usr" for your cygwin installation directory. Therefore the above path becomes:
C:\cygwin\lib\ruby\gems\1.8
Once in this location drill down until you come across the fssm gem directory.
Within this [fssm] directory go into:
/lib/fssm/
...and there you should find the pathname.rb file.
Edit it as above and all is well. I hope this helps.
See here for a possible fix:
http://rails.webintellix.com/2010/05/27/error-in-ruby-relative_path_from-call-on-windows/
I was running into this same error with a slightly different setup. My project folder was on a network drive (ruby and sass/compass installed locally), and every time I made a change to a .scss file compass watch would crash with similar errors to the OP. I solved the issue by mapping my network drive instead of accessing it directly via the network (right clicked on My Computer and choose map network drive so I could access my remote drive at A:).
Now, instead of doing 'compass watch //SERVERNAME/My_Project' (I'm using Git Bash), I do 'compass watch a/My_Project' and compass stopped crashing.
Hope that helps someone else.
Using Cygwin, re install a compass dev release (such as 0.13+). Works for me with Compass 0.13.alpha.4 (Markab)
To do so:
gem uninstall compass
gem install compass --pre --no-rdoc --no-ri

Resources