node-sass: File to import not found or unreadable: ./node_modules/
Asked Answered
T

1

6

This is my project files/folders structure:

myproject/
  themes/
    mytheme/
      .node_modules/
      source/
        css/
          mytheme.sass
      _config.yml
      package.json

So, I modified my myproject/themes/mytheme/source/css/mytheme.sass file in order to import two node_modules/ packages:

@import "./node_modules/minireset.css/minireset.sass"
@import "./node_modules/components-font-awesome/scss/font-awesome"

But when I execute hexo server and I navigate through my localhost server, I got this error message in Terminal:

Error: File to import not found or unreadable: ./node_modules/minireset.css/minireset.sass.
Error: File to import not found or unreadable: ./node_modules/components-font-awesome/scss/font-awesome.

So, how should I import these packages into my main SASS file? I'm using hexo-renderer-sass (https://github.com/knksmith57/hexo-renderer-sass).

Regards.

Twinned answered 21/11, 2017 at 14:57 Comment(0)
L
8

The path to your sass files has to be relative to the current sass file:

@import "../../node_modules/minireset.css/minireset.sass"
@import "../../node_modules/components-font-awesome/scss/font-awesome"
Lopsided answered 22/11, 2017 at 7:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.