kernel_require.rb: cannot load such file

9.3k Views Asked by At

I used gulp to build a html project. For some css staff,I used compass to build. I have task as follow

gulp.task('compass',function(){
    gulp.src('public_html/app/scss/style.scss')
            //.pipe(plumber())
            .pipe(compass({
                config_file: './config.rb',
                css: 'public_html/app/css',
                sass: 'public_html/app/scss',
                require: ['susy']
            }))
            //.pipe(autoprefixer('last 2 versions'))
            .pipe(gulp.dest('public_html/app/css'))
            .pipe(reload({stream:true}));
});

When I build as gulp compass, I have error as

LoadError on line ["55"] of ~/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb: cannot load such file -- susy
Run with --trace to see the full backtrace


events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Compass failed

I have that file kernel_require.rb in the exact folder. I export PATH as

 export PATH=$PATH:~/.rbenv/versions/2.3.1/lib   
export PATH=$PATH:~/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext 

But doesn't work. How to solve this error?

Thanks

EDIT:

gem list

*** LOCAL GEMS ***

cairo (1.12.8)
chunky_png (1.3.7)
compass-core (1.0.3)
compass-import-once (1.0.5)
execjs (2.7.0)
gettext (3.0.3)
locale (2.1.0)
multi_json (1.12.1)
rb-fsevent (0.9.7)
rdoc (3.9.4)
sass (3.4.22)
susy (2.2.12)
text (1.2.1)
nyan@nyan-Inspiron-7537:~$ susy -v
susy: command not found
1

There are 1 best solutions below

2
On

You were mis-interpreting the error message:

LoadError on line ["55"] of ~/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb: cannot load such file -- susy

The first part, LoadError, tells you what type of error you were running into; the documentation for LoadError states,

Raised when a file required (a Ruby script, extension library, ...) fails to load.

require 'this/file/does/not/exist'

raises the exception:

LoadError: no such file to load -- this/file/does/not/exist

The next part of the error message, on line ["55"] of ~/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:, tells you where the error occurred, that is, some piece of code called another piece of code which called another piece of code, eventually leading to line 55 of the file 'kernel_require.rb', which is part of the infrastructure of RubyGems. That line is, ultimately, what triggered the LoadError.

The final part of the error message, cannot load such file -- susy, gives you details about the problem; specifically, in the case of a LoadError such as this, it tells you what file it tried to (and failed) to load: 'susy'.

This all comes down to the fact that you had a directive in your gulp file, require: ['susy'], but did not have the 'susy' gem installed. As you discovered, installing 'susy' (with gem install susy) resolved the issue.

You also note that susy -v on the command line gave an error, but that's a red herring; the susy gem does not install any command line tools, only Ruby code.