-
Notifications
You must be signed in to change notification settings - Fork 1.3k
"File to read not found or unreadable" with -w under Windows #1894
Comments
I face the same issue with v4.5.0 on Windows 10. node-sass watch compiles for the first change then show error for the second change. The same node-sass version run well on Mac OSX 10.11.6 |
I also have this issue on Windows 10 and node v6.9.5 when calling from node script
In
|
Have the same error when making the following steps:
ERROR:
OS: Windows 10 |
Same issue on win10, node 7.7.4, visual studio code 1.10.2 |
Same issue on win10, node 6.9.5 when using node-sass with --watch flag. |
Hi, I've the same error when run such npm script:
I'm using VS Code. After I tried to edit and save sccs file with notepad there are no any issues, all works fine. Who have troubles do you all also use VS Code? |
Have the same error when making the following steps... OS: Windows 10 |
This sounds like an issue with atomic saves. Make sure you disable atomic_save in Sublime. |
You're also likely to have issues if you files are on a networked drive or container because of delays when writing the files. This is a limitation of filesystem watchers and not something node-sass can do anything about. |
grunt-watch works flawlessly, so it is a problem with node-sass |
Have the same problem. |
Could all the "me too" people say clearly which filesystem are they using on the affected drive? Is it local NTFS drive? If this is not a local NTFS drive? Can you reproduce the problem using local C: drive? |
NTFS, local, primary |
NTFS, local, secondary. |
I am afraid this must be something with the way node watches file changes, not much we can do with node-sass :( it probably belongs to the node itself |
I'm not familiar with c++ but it seems like this line is suspicious: |
I done another test. var chokidar = require('chokidar')
var fs = require('fs')
var path = require('path')
var sass = require('node-sass')
var srcDir = path.resolve(__dirname, "../src")
var distDir = path.resolve(__dirname, "../dist")
chokidar.watch(path.join(srcDir, "**/*.scss")).on('all', (event, _path) => {
console.log("File changed: ", _path)
setTimeout(() => {
sass.render(
{
file: path.join(srcDir, "styles/main.scss"),
outFile: path.join(distDir, "main.css"),
sourceMap: true
},
function (err, result) {
if (err) {
console.log(err)
} else {
fs.writeFile(path.join(distDir, "main.css"), result.css, (err) => {
if (err) {
console.log(err)
}
})
fs.writeFile(path.join(distDir, "main.css.map"), result.map, (err) => {
if (err) {
console.log(err)
}
})
}
}
)
}, 100)
}) Result: no errors :DNow I'm sure it's as I described in the previous comments |
@sbfkcel this situation can occur because the VS Code and Node.js processes operate independently of each other. In other transplers like LESS or Stylus, this problem probably is not occur (I haven't analyzed their code) because they are much slower and before they start reading from the file, the IDE is able to perform all operations on the file. |
I've created a PR that fix this problem: #2386 If want to try this fix, you can patch your node-sass local copy by replacing 'node_modules/node-sass/lib/render.js' with this version: https://github.com/marcosbozzani/node-sass/blob/bug-vscode-watch/lib/render.js The diff is here: marcosbozzani@266861b#diff-a485abf5b8f49de7f313d7799df3faf4 |
@marcosbozzani works form me on windows 10 and node-sass 4.9.0 version! |
"node-sass": "^4.9.0", didn't worked for me, had to replace the file, only then it worked @MatteoPieroni @marcosbozzani |
@marcosbozzani |
works win10 node-sass 4.9.2 thx @marcosbozzani |
Thanks a lot! |
thanks mate @marcosbozzani ..it really works! |
I'm using version 5.6.0 (npm - v sass) and it breaks sass. Am I doing something wrong? |
@marcosbozzani Thanks for the PR but this doesn't seem to work for me on Windows 10, VSCode, using node-sass-chokidar. In fact, it 's so bad that it completely crahes my npm run. If some one's one chokidar and reading this, take a look at this solution instead: michaelwayman/node-sass-chokidar#14 (comment) However, I would still like to say that looking at your code this isn't really a fix, more something that should serve as a temporary patch. It can't be that a solution consists of: trying a thousand times and if that not works, throwing an error. |
@marcosbozzani Thank you so much. It works! |
Thanks a ton @marcosbozzani !! |
thanks!!!!!!!!!! @marcosbozzani |
look at this site. it solve my problem wit this error |
Thanks, it works!! @marcosbozzani |
Thank you @marcosbozzani it worked for me with node sass 4.11.0 |
npm -v
): 4.2.0node -v
): v7.5.0node -p process.versions
):node -p process.platform
): win32node -p process.arch
): x64node -p "require('node-sass').info"
):npm ls node-sass
):Randomly when using node-sass directly from command line (without gulp), it fails with the error:
the file exists all the time, the HDD is fine and healthy. it fails around 30% of the time, and I have to re-save the file for the watch to recompile. sometimes it fails 4-5 times in a row. the ownership of the files are fine, no symlinks are being used, if it matters, I'm using VSCode (but the problem happens with EmEditor as well)
The text was updated successfully, but these errors were encountered: