Node-sass: "File to import not found or unreadable:" when watching file with imports

Created on 30 May 2019  路  5Comments  路  Source: sass/node-sass

  • NPM version (npm -v): 6.9.0
  • Node version (node -v): 10.16.0
  • Node Process (node -p process.versions):
    { http_parser: '2.8.0',
    node: '10.16.0',
    v8: '6.8.275.32-node.52',
    uv: '1.28.0',
    zlib: '1.2.11',
    brotli: '1.0.7',
    ares: '1.15.0',
    modules: '64',
    nghttp2: '1.34.0',
    napi: '4',
    openssl: '1.1.1b',
    icu: '64.2',
    unicode: '12.1',
    cldr: '35.1',
    tz: '2019a' }
  • Node Platform (node -p process.platform): win32
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"):
    node-sass 4.12.0 (Wrapper) [JavaScript]
    libsass 3.5.4 (Sass Compiler) [C/C++]
  • npm node-sass versions (npm ls node-sass):
    [email protected] C:UsersWesselDesktoptest-folder
    `-- [email protected]

    When my main.scss with import is being watched and I change + save the file that is being imported, I get this error message regularly (about 25 - 50% of the time):

    {
    "status": 1,
    "file": "C:/Users/Wessel/Desktop/test-folder/SCSS/main.scss",
    "line": 1,
    "column": 1,
    "message": "File to import not found or unreadable: base/reset.",
    "formatted": "Error: File to import not found or unreadable: base/reset.n on line 1 of SCSS/main.scssn>> @import "base/reset";n ^n"
    }

    My folder structure:

    bugNode-Sass

    When I change my _reset.scss file and save, sometimes I get the green "Rendering Complete, saving .css file...
    Wrote CSS to C:UsersWesselDesktoptest-folderstyle.css" and sometimes I get the error message. It seems really random.

    bugNode-Sass2

Most helpful comment

Solve this by installing nodemon:

npm install nodemon --save-dev

Then adding these two in package.json:

"scripts": {
"compile:sass": "node-sass sass/main.scss css/style.comp.css"
"watch:sass": "nodemon -e scss -x "npm run compile:sass""
}

All 5 comments

same error anyone has a fix ?

This is an issue with VS Code. There is a patch over in #2680, but it is specific to an IDE

Solve this by installing nodemon:

npm install nodemon --save-dev

Then adding these two in package.json:

"scripts": {
"compile:sass": "node-sass sass/main.scss css/style.comp.css"
"watch:sass": "nodemon -e scss -x "npm run compile:sass""
}

This is an issue with VS Code. There is a patch over in #2680, but it is specific to an IDE

2680 is this issue, did you mean a different one?

Yeah, #2386 should be the right link

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NathanKleekamp picture NathanKleekamp  路  4Comments

paulcpederson picture paulcpederson  路  3Comments

harukaeru picture harukaeru  路  3Comments

mkbctrl picture mkbctrl  路  4Comments

nagyfej picture nagyfej  路  3Comments