1

I'm building an Express app with Sass and I haven't made ANY changes to my project since I last compiled my .scss and .css files.

The command:

sass sass/style.scss style.css

was working the last time I worked on my project, but today I'm getting this error:

Errno::ENOENT: No such file or directory @ rb_sysopen - sass/style.scss
  Use --trace for backtrace.

Again, I've made NO NEW changes since this was last working, and I've even reverted to a previous git commit.

In my app.js, I have node-sass-middleware configured like this:

var sassMiddleware = require('node-sass-middleware');

and this:

app.use(sassMiddleware({
  src: path.join(__dirname, 'public/stylesheets/sass'),
  dest: path.join(__dirname, 'public/stylesheets'),
  debug: true,
  indentedSyntax: true,
  outputStyle: 'compressed',
  prefix: '/stylesheets'
}));
app.use(express.static(path.join(__dirname, 'public')));

and my public file structure in My-Website/public looks like this:

├── public
    └── stylesheets
        ├── sass
            └── style.scss
        ├── style.css
        └── style.css.map

Also, in my layout.hbs file in my views folder (I'm using the handlebars templating language for Express), I have this link in my head:

    <link rel='stylesheet' href='/stylesheets/style.css' />

What is going on?

Alya
  • 13
  • 3
  • Looks like you have a typo: `stylesheets/sass/style.scss`, not `sass/style.scss` – bren Aug 14 '16 at 20:04
  • That results in the same error. And based on the answer to this question: http://stackoverflow.com/questions/30654312/why-node-sass-middleware-is-not-working, I was under the impression that Sass would be looking for the compiled `style.scss` at `My-Website/public/stylesheets` (which is the `dest` in the middleware configuration). – Alya Aug 14 '16 at 20:18
  • You have multiple components going on here, the command `sass` and `node-sass-middleware`, which uses the `sass` command to compile the sheets. In the beginning of the post you reference the `sass` command not working, and then you transition into your express script, which I assume means it also doesn't work. Check your current working directory, and ensure that it's `public/stylesheets/` when you run the first command – bren Aug 14 '16 at 20:34
  • That worked, thank you! Just to clarify, the only problem was the sass command not working. Middleware was included in case that's where the problem lay. But either way, problem solved. – Alya Aug 14 '16 at 20:40
  • I'll paste my comment into an answer so you can mark it as answered (this is standard practice, IIRC) – bren Aug 14 '16 at 20:58

1 Answers1

0

You have multiple components going on here, the command sass and node-sass-middleware, which uses the sass command to compile the sheets. In the beginning of the post you reference the sass command not working, and then you transition into your express script, which I assume means it also doesn't work. Check your current working directory, and ensure that it's public/stylesheets/ when you run the first command

bren
  • 4,176
  • 3
  • 28
  • 43