Angularのチュートリアルを進めていたら、ngcc is already running

上記記事で、dockerにてAngular環境を立てて、チュートリアルを進めていたら
ナビゲーションの追加で以下エラーが発生した。

/projects/my-app/node_modules/@angular/compiler-cli/ngcc/src/locking/sync_locker.js:59
            throw new Error("ngcc is already running at process with id " + pid + ".\n" +
            ^

Error: ngcc is already running at process with id 47.
If you are running multiple builds in parallel then you might try pre-processing your node_modules via the command line ngcc tool before starting the builds.
(If you are sure no ngcc process is running then you should delete the lock-file at /projects/my-app/node_modules/@angular/compiler-cli/ngcc/__ngcc_lock_file__.)
    at SyncLocker.handleExistingLockFile (/projects/my-app/node_modules/@angular/compiler-cli/ngcc/src/locking/sync_locker.js:59:19)
    at SyncLocker.create (/projects/my-app/node_modules/@angular/compiler-cli/ngcc/src/locking/sync_locker.js:51:22)
    at SyncLocker.lock (/projects/my-app/node_modules/@angular/compiler-cli/ngcc/src/locking/sync_locker.js:32:18)
    at SingleProcessExecutorSync.execute (/projects/my-app/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:57:27)
    at Object.mainNgcc (/projects/my-app/node_modules/@angular/compiler-cli/ngcc/src/main.js:74:25)
    at Object.process (/projects/my-app/node_modules/@angular/compiler-cli/ngcc/index.js:29:23)
    at NgccProcessor.processModule (/projects/my-app/node_modules/@ngtools/webpack/src/ngcc_processor.js:163:16)
    at /projects/my-app/node_modules/@ngtools/webpack/src/ivy/host.js:109:18
    at /projects/my-app/node_modules/@ngtools/webpack/src/ivy/host.js:39:24
    at Array.map (<anonymous>)
    at Object.host.resolveModuleNames (/projects/my-app/node_modules/@ngtools/webpack/src/ivy/host.js:37:32)
    at actualResolveModuleNamesWorker (/projects/my-app/node_modules/typescript/lib/typescript.js:105298:133)
    at resolveModuleNamesWorker (/projects/my-app/node_modules/typescript/lib/typescript.js:105536:26)
    at resolveModuleNamesReusingOldState (/projects/my-app/node_modules/typescript/lib/typescript.js:105726:19)
    at processImportedModules (/projects/my-app/node_modules/typescript/lib/typescript.js:107137:35)
    at findSourceFileWorker (/projects/my-app/node_modules/typescript/lib/typescript.js:106909:17)

チュートリアルでも下記が書かれていたので、

こちらのCLIコマンドを使用して実行する必要があります。

ng serve

ブラウザを更新するとアプリのタイトルは表示されますがヒーローのリストは表示されないはずです。
ブラウザのアドレスバーを見てみましょう。 URLが/で終わっています。 HeroesComponentへのルーターのパスは/heroesです。
ブラウザのアドレスバーでURLに/heroesを追加します。 おなじみのヒーローのマスター/詳細ビューが見れるはずです。

ng serve を再実行するもうまくいかない。

$ ng serve --host 0.0.0.0
Warning: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.

Binding this server to an open connection can result in compromising your application or
computer. Using a different host than the one passed to the "--host" flag might result in
websocket connection issues. You might need to use "--disableHostCheck" if that's the
case.
An unhandled exception occurred: ngcc is already running at process with id 47.
If you are running multiple builds in parallel then you might try pre-processing your node_modules via the command line ngcc tool before starting the builds.
(If you are sure no ngcc process is running then you should delete the lock-file at /projects/my-app/node_modules/@angular/compiler-cli/ngcc/__ngcc_lock_file__.)
See "/tmp/ng-z8L5HX/angular-errors.log" for further details.

解決法

node_modules/@angular/compiler-cli/ngcc/ngcc_lock_file を削除して
再度アプリケーション実行すればいけました。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です