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 1 year has passed since last update.

[備忘録] Error: spawnSync docker ENOENTの解消

Posted at

はじめに

AWS CDKで Lambda を作成、デプロイしようとしたところ下記エラーが発生した。

% cdk deploy
Error: spawnSync docker ENOENT
    at Object.spawnSync (node:internal/child_process:1111:20)
    at spawnSync (node:child_process:814:24)
    at dockerExec (/Users/user/Documents/app/node_modules/aws-cdk-lib/core/lib/private/asset-staging.js:1:3385)
    at Function.fromBuild (/Users/user/Documents/app/node_modules/aws-cdk-lib/core/lib/bundling.js:1:4085)
    at new Bundling (/Users/user/Documents/app/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/bundling.js:1:2315)
    at Function.bundle (/Users/user/Documents/app/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/bundling.js:1:599)
    at new NodejsFunction (/Users/user/Documents/app/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/function.js:1:1221)
    at new AppStack (/Users/user/Documents/app/lib/app-stack.ts:18:20)
    at Object.<anonymous> (/Users/user/Documents/app/bin/app.ts:7:1)
    at Module._compile (node:internal/modules/cjs/loader:1103:14) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawnSync docker',
  path: 'docker',
  spawnargs: [
    'build',
    '-t',
    'cdk-8d408efea9f2433343861a553b56c28ac5bcb99a4716e393c58d1b7029a59b35',
    '--platform',
    'linux/amd64',
    '--build-arg',
    'IMAGE=public.ecr.aws/sam/build-nodejs16.x',
    '--build-arg',
    'ESBUILD_VERSION=0',
    '/Users/user/Documents/app/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib'
  ]
}

実施したこと

macOSを使用しており、後述する記事とエラーも一致していたたため、記載の通り esbuild をインストールした。

% npm install --save-dev esbuild@0

その後再度 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?