-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watchpack Error (initial scan): Error: EACCES: permission denied, lstat '/mnt/c/...' #187
Comments
Can you provide structure of your project? |
See here. I can additionally provide my own setup, but it would take quite a while to strip it down to something that can be posted on GitHub. |
@Philipp91 Yep, please try to provide, and I will investigate this problem, I think something wrong in plugins/loaders/webpack-dev-server, because we are warning |
|
This may be a new behavior in webpack v5. Is it okay for webpack to tell watchpack to watch all those directories up to the root? |
What is |
It's |
It's normal that these directories are watched. The relevant entry is So the errors are actually irrelevant for watching these the |
Okay that makes sense. I find it a bit complex to implement due to the series of |
Each instances knows which files are watched on this instance. So there is a |
FWIW I found this thread after running into the same error on Arch Linux. I use pCloud which puts a fuse mount in my home directory and was getting I'm also not sure why it was getting permission denied when it tried, but it was certainly confusing and sent me down some rabbit holes trying to figure out what I misconfigured to make it even try. |
What terminal do you use? I have Windows and I am having the same issue with wsl. Try to use cmd instead. It worked for me. Good luck. |
I am having the same problem. I am in a process of migrating from Gatsby v2 to v3. As far as i understand, this has something to do with WSL2. I just hope that Gatsby team will not forget this issue. |
Also running into this. My watch options are only ignoring node_modules so I'm not sure why this would be happening. |
Plus one running into the same issue with WSL2 + Windows 10. Watchpack Error (initial scan): Error: EACCES: permission denied, lstat '/c/DumpStack.log.tmp' |
Plus another, also with WSL2 + Windows 10 Watchpack Error (initial scan): Error: EACCES: permission denied, lstat '/mnt/c/DumpStack.log.tmp' |
Well i also run into the same error. Running windows 10 x64 bit Watchpack Error (initial scan): Error: UNKNOWN: unknown error, lstat 'C:$360Section' |
|
js
const path = require("path");
// webpack config
module.exports = {
// partner area main app entry for
entry: {
"App.bspa": "./App.bspa.js",
"App.Admin": "./App.Admin.js",
},
output: {
filename: "[name].min.js",
path: path.resolve(__dirname, "www/dist"),
},
mode: "development",
watch: true,
devtool: "eval-source-map",
watchOptions: {
ignored: ["**/node_modules"],
poll: 1000,
aggregateTimeout: 100,
},
module: {
rules: [
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: "asset/resource",
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: "asset/resource",
},
],
},
}; |
|
@obipascal I mean path to the project, i.e. |
|
I have this issue on WSL2
Can reproduce like this
|
I kind of wonder what watchpack is doing with swapfile.sys or through which part. As the course progress, the instructor introduced webpack, and hence, this problem! |
@sokra It seems like you had a particular workaround in mind. It would be great if you could implement and release that. As you say, the errors are harmless. But they don't look like that, and in the face of any (unrelated) issues with Webpack, people will waste lots of time investigating them, and some of the end up here and even take the time to post screenshots and repro-instructions here, which shows how much time they've previously spent on debugging. We should save that time by suppressing the errors. |
/cc @sokra |
Same here: WSL 2, win 10
|
I get this as well in windows 10 wsl 2, after converting to gatsby 3 in my project |
Okay, finally fixed it. The problem is with the path as already someone said. Your project should not be located at
|
The directory |
After test driving Next.js for the first time today, this issue resulted in long meeting with our corporate security team to make sure some bad actor in the dependency chain didn't just steal a bunch of information. To take the liberty to go outside the scope like this feels like a trust violation. This wasn't installed as a global npm module. Local should stay local. Or am I misunderstanding Node's ecosystem?
|
Same problem. Win 11 and WSL2. |
I'll fix the unnecessary warnings, but that won't fix the watching. Watching in See also this (long) issue: microsoft/WSL#4739 |
Hey guys. Try:
If don't work install webpack global package and try again. |
The path to the executable is incorrect. Either because the executable is
in a non default file or because the path was never set.
There's options in the systems of the Windows computer that you can set
paths towards executables for the WSL. I don't know all the specifics but
this is what I've done in the past to absolve these kind of issues. Sorry I
can't help more.
…On Tue, Jul 20, 2021, 11:13 Bohdan Yurov ***@***.***> wrote:
@dbooyah93 <https://github.com/dbooyah93> is there any fix for this issue?
For many people "simply" moving project is impossible due to various
reasons. I also don't quite understand why any program would go through
whole directory listing, this is literally something that is against unix
way - users don't expect project watcher to iterate through whole hierarchy
to list and watch every ancestor.
I can put it in the following way: does anyone even expect this behavior?
It is counter-intuitive
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#187 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMMF3N7VCVQ66UBIABZSVCDTYWOCTANCNFSM4VS3LWJA>
.
|
This one fixed it for me! Thank you! |
So, I ran into this issue to because I was dumb and accidently ran As others have mentioned, With WSL2 when running a Git repo + node_modules on a windows filesystem but compiling within the /mnt/c/* path with WSL2 is notoriously slow! Because windows filesystem access through WSL2 is not performant. Microsoft calls this out and recommends people run WSL1 if you are trying that approach -> Source For me, I just want to code in VSCode, and use all the useful kernel level tools and tooling in linux eco-system, including nodejs, apt-get tools, etc. Some people have problems moving the project to internal system in linux because it's less accessible and off the NTFS file system (for permissions). For me personally a good hybrid solution was to move the entire project inside the linux home directory. Then inside WSL2 prompt at the path of the project you can run I then took that UNC folder path and made it a shortcut where the initial project used to exist on "c:\source\projectA (/mnt/c/source/projectA) so that I can still open and develop in VSCode. This solution only works well if you're not dependent on |
It worked for me! Tnks bro 👍🏻 |
Nothing here worked for me, my source is within wsl2 filesystem (/home//git/ but still it tries to scan the entire filesystem including /mnt/, /proc/
the list goes on, I think it extends every file in wsl2 (including windows filesystem in /mnt/) Are we close to figure this out? |
rather web folders are also scanned, than this is restricted to the working folder... |
work for me too |
If anyone else encounters this like I did on Windows with WSL, I glanced over watchpack's code tonight and didn't see anything fishy as of 7-30-2022. What I really worry about is Watchpack recursively iterating my drive and sending its results elsewhere. As would anyone when they start to see the code getting access denied to directories that aren't exactly what you asked it to watch. Its a relatively simple codebase and if you're worried, I recommend taking a look at it or watchpacks' own files on your system. |
Suggesting folks move their code from The same holds true for anyone trying to excuse the bad behavior of Watchpack / Webpack. Creating a file watcher at any parent folder to your project means you are allowing the component to examine, and possibly react to, file changes in completely unrelated folder structures. Even if we want to believe that no harm will come to those other files and folders, at a minimum this means that additional processing power is unnecessarily being used watching countless files that are not relevant to our project. On my Linux and Mac boxes I use The bottom line is that a project folder is created to ensure only the files in that structure are ever touched. No utility has any business touching, watching, or examining any other folder or file on the system. Doing so is unethical and, at a minimum, incredibly lazy. Stop excusing bad behavior. |
I'm trying to create next.js app with
on my hosting provider. After that I run
The app seems to be started, but I get following errors: testh3@vs828:/var/www/testh3/test.gsmcounters.com$ npm run dev [email protected] dev next dev
How can I change that behaviour to fix error? |
same here, did you managed to fix it? |
I think you might need a new sub. Check that the node version you have matches the dependency version. It's so specific that it's hard to tell with just this. Create a new thread with all the details of your local server |
I wrote a Hack plugin to workaround this issue: import {Compiler} from 'webpack';
...
apply(compiler: Compiler) {
const lookupSet = new Set<string>(['/', '/data', '/data/data']; // Those EACCES directories
compiler.hooks.done.tap('TermuxIssueResolve', stats => {
for (const item of stats.compilation.fileDependencies) {
if (lookupSet.has(item)) {
// eslint-disable-next-line no-console
console.log('[TermuxIssueWebpackPlugin] remove unaccessible fileDependency', item);
stats.compilation.fileDependencies.delete(item);
}
}
});
}
... |
Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/Volumes/Projects/.fseventsd' |
This is still happening in latest next js 13.4 |
Just for completeness' sake, since most people seem to have this problem on Windows, I got it on Mac. System: MacOS Ventura Version 13.4.1 Watchpack Error (watcher): Error: EACCES: permission denied, watch '/Volumes/code/.fseventsd'
Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/Volumes/code/.fseventsd' The project(s) are in a |
Interestingly enough: The problem doesn't occur when I copy the project to my main volume. So since many WSL users have it, might it be related to running on a different volume then the user? |
Hi @essenmitsosse I'm using a different volume too on MacOS, |
For those who have the same error on an angular project, might be worth loking at this answer. it fixed my project that has been given me headaches since the start of this post |
Where did you put this code tho? Thanks |
Hi @irisma00! you can add this code directly in the "plugins" attribute of your webpack.config.js like so: // Example webpack.config.js file
module.exports = {
entry: {
app: "./src/index.js",
},
...
plugins: [
{
apply: function(compiler) {
const lookupSet = new Set(["/", "/data", "/data/data"]) // Those EACCES directories
compiler.hooks.done.tap("WatchpackBugWorkaroundPlugin", (stats) => {
for (const item of stats.compilation.fileDependencies) {
if (lookupSet.has(item)) {
console.log(
"[WatchpackBugWorkaroundPlugin] remove inaccessible fileDependency",
item
)
stats.compilation.fileDependencies.delete(item)
}
}
})
}
},
], Replace the file paths in I don't understand Webpack enough to judge if @liujingbreak's code does the job, perhaps those who try out this hack can test it out together. Update: I tested out the code, and it works: it removes the chosen directories from being watched. I tested that it works as intended using 2 ways. First, I deliberately added the path to a source file in my project in the strace -fe inotify_add_watch ./node_modules/.bin/webpack-dev-server --mode development 2>&1 | sed -u "s#$(pwd)#.#g" | grep -o --line-buffered '".*"' | tr -d '"' Source: https://hassansin.github.io/Finding-out-Which-Files-Are-Watched-by-Webpack-Using-Strace I also tweaked our hack plugin abit to only include files from my project's UI source code folder: apply: function (compiler) {
const sourceCodeDirectory = path.resolve(__dirname, "src")
compiler.hooks.done.tap(
"WatchpackBugWorkaroundPlugin",
(stats) => {
for (const item of stats.compilation.fileDependencies) {
if (!item.includes(sourceCodeDirectory)) {
stats.compilation.fileDependencies.delete(item) So this hack plugin works as intended! Now I no longer need to worry about webpack watching unrelated files outside my project folder whichexausts the system's P.s: I have this issue on both Ubuntu server 22.04 and Termux on Android. The testing of the hack plugin was only done on Termux on Android. |
I have the same on Linux, with Docosaurus, which uses webpack underneath. My project is in
It makes no sense why this would try to touch I'm trying to find out how I can apply the above Hack plugin, but since webpack is hidden from me in this case, it's a whole lot harder |
I run
webpack --watch --watch-options-stdin ...
and amidst its initial build (not the subsequent builds triggered by changed files), it prints:Someone already reported the problem here, so I'll refer to those details for reproduction. Key elements are webpack v5 and WSL1 under Windows.
The directory
/mnt/c
maps to the Windows root driveC:\
, which contains these special files like the swapfile, to which the user doesn't have access. That is, the commandls /mnt/c
fails on the command line too. So it's not surprising that it fails for watchpack too.What is surprising (to me) is that watchpack attempts to list that directory to begin with. I have no config telling webpack/watchpack what to watch, only that
--watch
flag. Can someone explain this to me?The text was updated successfully, but these errors were encountered: