tsc
Buildkite ビルド パイプラインでコンパイルが無期限に停止するという問題が発生しています。
の詳細なオプションが見つからないtsc
ので、私が持っている最高のものは--traceResolution
.
私のローカルマシンでは、出力された最後の行は次のとおりです。
======== Type reference directive 'jest' was successfully resolved to '/Users/djohnston/git/myproject/node_modules/@types/jest/index.d.ts' with Package ID '@types/jest/index.d.ts@26.0.20', primary: true. ========
✨ Done in 6.35s.
ビルド パイプラインの最後のコマンドは次のとおりです。
[2021-03-12T00:59:08Z] ======== Type reference directive 'jest' was successfully resolved to '/app/node_modules/@types/jest/index.d.ts' with Package ID '@types/jest/index.d.ts@26.0.20', primary: true. ========
したがって、解決は完全に完了したようです。
TypeScript がここでハングする原因として他に何が考えられますか? この質問が示唆するように、それはメモリの問題でしょうか?
デバッグを支援するために追加できるコマンド/フラグは他にもありますか?
記憶調査
ビルド エージェントは AWS EC2 t2.large インスタンスで、8 GB の RAM を備えています。
パイプライン コマンドを次のように更新しました。
top -bn1 && yarn test
テストは次のとおりです。
tsc --version && tsc --diagnostics && tsc --traceResolution
そして私は得る:
[2021-03-12T01:51:50Z] Mem: 3348592K used, 4818096K free, 504K shrd, 1576K buff, 2005316K cached
[2021-03-12T01:51:50Z] CPU: 0% usr 0% sys 0% nic 100% idle 0% io 0% irq 0% sirq
[2021-03-12T01:51:50Z] Load average: 1.49 0.47 0.17 2/280 279
[2021-03-12T01:51:50Z] PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND
[2021-03-12T01:51:50Z] 279 6 root R 1580 0% 0 0% top -bn1
[2021-03-12T01:51:50Z] 6 1 root S 1580 0% 1 0% /bin/sh -e -c .buildkite/scripts/prepare_npmrc.sh && yarn install && yarn bootstrap && yarn format:check && yarn lint && top -bn1 && yarn test && yarn build
[2021-03-12T01:51:50Z] 1 0 root S 1052 0% 1 0% /sbin/docker-init -- docker-entrypoint.sh /bin/sh -e -c .buildkite/scripts/prepare_npmrc.sh && yarn install && yarn bootstrap && yarn format:check && yarn lint && top -bn1 && yarn test && yarn build
したがって、4.8GB しか利用できないにもかかわらず、実際に合計 8GB があることを確認しているようです。
そして2番目の部分について:
[2021-03-12T01:54:23Z] $ tsc --version && tsc --diagnostics && tsc --traceResolution
[2021-03-12T01:54:23Z] Version 4.2.3
[2021-03-12T01:54:23Z] Files: 1199
[2021-03-12T01:54:23Z] Lines: 194583
[2021-03-12T01:54:23Z] Nodes: 504127
[2021-03-12T01:54:23Z] Identifiers: 163089
[2021-03-12T01:54:23Z] Symbols: 201735
[2021-03-12T01:54:23Z] Types: 37565
[2021-03-12T01:54:23Z] Instantiations: 691770
[2021-03-12T01:54:23Z] Memory used: 256799K
[2021-03-12T01:54:23Z] I/O read: 0.13s
[2021-03-12T01:54:23Z] I/O write: 0.00s
[2021-03-12T01:54:23Z] Parse time: 5.04s
[2021-03-12T01:54:23Z] Bind time: 2.01s
[2021-03-12T01:54:23Z] Check time: 8.02s
[2021-03-12T01:54:23Z] Emit time: 0.00s
[2021-03-12T01:54:23Z] Total time: 15.07s
250MB しか必要ないように見えるので、これがメモリの問題であることはわかりません。
助言がありますか?
更新 - lerna/monorepos と関係があるようです。
このプロジェクトの構造は、実際には次のようになります。
/
package.json
test: "lerna run test"
build: "lerna run build"
packages/
package-a
test: "tsc && jest" <- is failing here
package-b
test: "..."
build: "..."
したがって、"yarn test" を実行する Pipeline.yml では、実際にはその個々のコマンドを実行する "lerna run test" を実行しています。
「cd packages/package-a && yarn test」に変更すると、パスします。
docker workdir ディレクトリが問題になる可能性があると彼らが言及しているこのタイプスクリプトの問題に関係している可能性があります。