0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AWS-CDKのエラー ENOENT: no such file or directory, open ‘/asset-input/node_modules/hoge’

Posted at

AWS-CDKで今まで何も問題なくデプロイできていたTypeScriptのLambda関数で、ある日突然デプロイ時にエラーENOENT: no such file or directoryが発生するようになりました。

% cdk deploy
Bundling asset hogeStack/fuga/Code/Stage…
Building hoge.ts…
🚨 Build failed.
Error: ENOENT: no such file or directory, open ‘/asset-input/node_modules/aws-amplify/lib/index.js’
Error: ENOENT: no such file or directory, open ‘/asset-input/node_modules/aws-amplify/lib/index.js’
Failed to bundle asset hogeStack/fuga/Code/Stage, bundle output is located at /Users/a/work/cdk/cdk.out/bundling-temp-52790e2ed2ab60b0cf0a67c80b7d81e7a04f6181172a1a2161b2d92a5411d441-error: Error: docker exited with status 1
Subprocess exited with error 1

rm -r node_modules && yarn installしてみても解消しません。少し調べたところ、Lambdaのデプロイに使用しているaws-lambda-nodejsモジュールが、ParcelというJavaScriptバンドラを使ってTypeScriptへのトランスパイルをしていることがわかりました。

Parcelはキャッシュを使うようで、CDKディレクトリの中に.parcel-cacheという名前のディレクトリを発見しました。これを削除してからcdk deployしたところ、エラーは無事起きなくなりました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?