Watchpack error scandir EACCESS, can't run ng serve

Viewed 17

Since yesterday, I'm trying to run a project made in Angular (12.1.3), that I'm working for more than a year, but I'm only getting errors.

Those erros are a lot of Watchpack errors, followed by something like an exception.

Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/usr/lib/mysql/plugin/auth_pam_tool_dir'
Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/var/cache/apt/archives/partial'

... some million of lines pointing to random systme files/dirs ...

Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/var/lib/apt/lists/partial'
Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/var/lib/samba/private/msg.sock'

<--- Last few GCs --->

[33080:0x616b410]    69565 ms: Mark-sweep (reduce) 2028.9 (2051.3) -> 2028.5 (2055.5) MB, 724.2 / 2.4 ms  (average mu = 0.189, current mu = 0.084) allocation failure scavenge might not succeed
[33080:0x616b410]    70305 ms: Mark-sweep (reduce) 2029.5 (2055.0) -> 2029.3 (2055.0) MB, 737.5 / 2.2 ms  (average mu = 0.103, current mu = 0.003) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa3ac10 node::Abort() [ng serve -o]
 2: 0x970199 node::FatalError(char const*, char const*) [ng serve -o]
 3: 0xbba58e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [ng serve -o]
 4: 0xbba907 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [ng serve -o]
 5: 0xd76b25  [ng serve -o]
 6: 0xd776af  [ng serve -o]
 7: 0xd854eb v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng serve -o]
 8: 0xd890ac v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [ng serve -o]
 9: 0xd5778b v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [ng serve -o]
10: 0x109fd4f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [ng serve -o]
11: 0x1448f59  [ng serve -o]
Aborted (core dumped)

I don't understand why those errors are pointing to system files/dirs (like /var, /etc, /proc etc).

I really don't know why this is happening, and how to fix it. Some other developers that also work into this project aren't experiencing this error, just me. This makes me think that is a problem in my computer/dev environment, but even testing on a clean virtual machine, only with Node and Git installed, the error also happens.

I've already tried to set fs.inotify.max_user_watches=524288 into /etc/sysctl.conf, but no success.

1 Answers

After checking other commits in this project, I've found someone else's commit that added a server-config file (web.config), and set up the angular.json file to include this file into builds.

The problem was the path set for this web.config file. It was:

"assets": [
  "src/favicon.ico",
  "src/assets",
  {
    "glob": "web.config",
    "input": "/",
    "output": "/"
  }
]

when it must be

"assets": [
  "src/favicon.ico",
  "src/assets",
  {
    "glob": "web.config",
    "input": ".",
    "output": "."
  }
]

to tell Node/Angular to inclue the web.config file "here", not "there".

Using only /, Node was interpreting it as the root of my system, instead the root of my project. So, I needed to change it to only . to tell Node to use the current directory (the root of my project).

Also, I can use ./ into this setting, but, to avoid other systems (Windows) having trouble with that, I've just used ., that is "universal" for pointing to current directory.

Hope this may help someone else.

Related