繁体   English   中英

Watchpack 错误 scandir EACCESS,无法运行 ng serve

[英]Watchpack error scandir EACCESS, can't run ng serve

从昨天开始,我正在尝试运行一个在 Angular (12.1.3) 中制作的项目,我已经工作了一年多,但我只是遇到错误。

这些错误是很多Watchpack error ,然后是异常。

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)

我不明白为什么这些错误指向系统文件/目录(如 /var、/etc、/proc 等)。

我真的不知道为什么会发生这种情况,以及如何解决它。 其他一些也参与这个项目的开发人员没有遇到这个错误,只有我。 这让我认为这是我的计算机/开发环境中的问题,但即使在干净的虚拟机上进行测试,仅安装了 Node 和 Git,也会发生错误。

我已经尝试将fs.inotify.max_user_watches=524288设置为 /etc/sysctl.conf,但没有成功。

在检查了该项目中的其他提交后,我发现其他人的提交添加了一个服务器配置文件 (web.config),并设置了 angular.json 文件以将此文件包含到构建中。

问题是为此 web.config 文件设置的路径。 它是:

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

什么时候必须

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

告诉 Node/Angular 包含 web.config 文件“这里”,而不是“那里”。

仅使用/ ,Node 将其解释为我的系统的根目录,而不是我的项目的根目录。 所以,我需要将其更改为 only . 告诉 Node 使用当前目录(我的项目的根目录)。

此外,我可以在此设置中使用./ ,但是为了避免其他系统(Windows)遇到问题,我刚刚使用了. ,即指向当前目录的“通用”。

希望这可以帮助别人。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM