mattpolicastro
mattpolicastro

Reputation: 377

Sass: errno::enoent: No such file or directory

I know this is a terribly bland error to be running into, but I'm encountering a regular "file not found" error in Sass 3.4.2:

/*
Errno::ENOENT: No such file or directory - dumdum.scss

Backtrace:
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/plugin/compiler.rb:482:in `read'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/plugin/compiler.rb:482:in `update_stylesheet'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/plugin/compiler.rb:209:in `each'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/plugin/compiler.rb:209:in `update_stylesheets'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/plugin/compiler.rb:293:in `watch'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/plugin.rb:108:in `method_missing'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/exec/sass_scss.rb:381:in `watch_or_update'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/exec/sass_scss.rb:51:in `process_result'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/exec/base.rb:52:in `parse'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/lib/sass/exec/base.rb:19:in `parse!'
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.12/bin/sass:13:in `<top (required)>'
/usr/bin/sass:23:in `load'
/usr/bin/sass:23:in `<main>'
*/

I've run into this before, but I've had no luck in diagnosing/solving it. It also shows up as a weird element in the page its linked to.

Could someone help me understand the traceback? I'm sure it's something incredibly simple, but I know very little Ruby. I've tried removing/reinstalling Sass.

Upvotes: 7

Views: 12659

Answers (4)

A. JELLALI
A. JELLALI

Reputation: 23

I resolved this error:

"Sass: errno::enoent: No such file or directory" By moving the project directory Sass

** into Ruby folder:

PS C:\Ruby26-x64\Sass> sass --watch scss:css
>>> Sass is watching for changes. Press Ctrl-C to stop.
>>> Change detected to: scss/style.scss
      write css/style.css
      write css/style.css.map

Upvotes: 0

Call me Andy
Call me Andy

Reputation: 41

I had a similar issue, but couldn't resolve it with the solutions aforementioned, but I had to employ a hack and hope approach.

Things I tried before my hack and hope approach:

  1. I deleted all the .sass-cache folders which may contain my sass file
  2. I uninstalled and reinstalled the sass gem.
  3. I upgraded Ruby and Sass. For some reason, I can't uninstall the ruby command prompt cleanly. So I'm still using ruby 2.3.3p222 and Sass version 3.4.23

So my solution was to use sassmeister to convert the scss and that solved my problem. To compress the css file I used CSS Compressor. This method is effective, if you don't have a clean setup of the ruby/sass install.

  1. Next take the compressed css file and save a new CSS file with a new filename.
  2. Next, go to your html/php files and change the CSS filename to the new CSS filename from step 1, in your .
  3. This should do the trick. It worked for me.

Upvotes: 0

Guim
Guim

Reputation: 76

I faced a similar error in my project, deleting the sass-cache directory at the root of my project, then run sass/grunt again solved the problem for me...

rm .sass-cache/ -R

Hop this helps

Upvotes: 4

user3373470
user3373470

Reputation:

Whether Ruby or Rails (too), your backtrace means that an error is rising from the gem's code itself. If you were to open those files and follow the backtrace, you could see how the sass gem works.

EDIT: If you have manually un/installed a gem, it is best to run bundle install so you correctly match the specs in your Gemfile.lock. If such a file sounds new to you, I highly suggest reading http://bundler.io/ , a gem manager letting you control which gems/versions are required for your app!

NOTE: If you are working with Rails, the rest of my answer below may help. (Given from personal experience I've had a couple months ago.)

This error means that you do not have the file dumdum.scss in your directory, most likely app/assets/stylesheets/. I suggest doing a quick grep search for where you use dumdum. For example, in the app I am working on, I have a file _colors.scss, and it is referenced in and overrides stylesheet (for bootstrap) as @import "colors";.

Upvotes: 2

Related Questions