【问题标题】:ng serve not compilingng服务未编译
【发布时间】:2021-05-19 04:03:36
【问题描述】:

我试图用ng serve 运行我的本地服务器:

[error] Error: NGCC failed.
    at NgccProcessor.process (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/@ngtools/webpack/src/ngcc_processor.js:129:19)
    at compiler.hooks.thisCompilation.tap (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/@ngtools/webpack/src/ivy/plugin.js:112:27)
    at SyncHook.eval [as call] (eval at create (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:13:1)
    at SyncHook.lazyCompileHook (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/lib/Compiler.js:630:30)
    at hooks.beforeCompile.callAsync.err (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/lib/Compiler.js:667:29)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/lib/Compiler.js:662:28)
    at compiler.hooks.watchRun.callAsync.err (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/lib/Watching.js:77:18)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at AsyncSeriesHook.lazyCompileHook (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/node_modules/tapable/lib/Hook.js:154:20)
    at Watching._go (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/lib/Watching.js:41:32)
    at Watching.compiler.readRecords.err (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/lib/Watching.js:33:9)
    at Compiler.readRecords (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/lib/Compiler.js:529:11)
    at new Watching (/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/webpack/lib/Watching.js:30:17)

由于我对 JS/npm 世界不是很熟悉,我想知道它是否很常见且易于修复,还是我应该从头开始重新安装。

在遇到此问题之前,我安装了一些 npm 包时磁盘空间不足导致此错误:

54 verbose stack Error: ENOTEMPTY: directory not empty, rename '/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/@angular/core' -> '/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/@angular/.core-KuljwpJv'
55 verbose cwd /home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front
56 verbose Linux 5.8.0-50-generic
57 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "install" "@angular/animations" "--save"
58 verbose node v10.19.0
59 verbose npm  v7.12.0
60 error code ENOTEMPTY
61 error syscall rename
62 error path /home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/@angular/core
63 error dest /home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/@angular/.core-KuljwpJv
64 error errno -39
65 error ENOTEMPTY: directory not empty, rename '/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/@angular/core' -> '/home/geoffroy/Documents/1_projets_persos/35_ngodt/ngodt-front/node_modules/@angular/.core-KuljwpJv'
66 verbose exit -39

可能是由于文件夹锁定,我很确定这是我问题的根源。

【问题讨论】:

  • 您尝试过什么解决问题的方法?你被困在哪里了?
  • 我在磁盘上腾出了一些可用空间,重新启动了我的笔记本电脑,尝试使用 sudo 安装我的包。最后我删除了 node_module 过滤器并运行npm install,一切都很好。

标签: npm angular-cli


【解决方案1】:

我已删除/node_modules

然后我安装了依赖项

npm install

问题解决了

【讨论】:

    猜你喜欢
    • 2015-02-14
    • 2018-02-20
    • 1970-01-01
    • 2011-07-25
    • 2017-09-26
    • 1970-01-01
    • 2014-01-27
    • 1970-01-01
    • 2022-12-22
    相关资源
    最近更新 更多