Due to an incorrect check for a non-empty array here https://github.com/sst/v2/blob/49df4ace0bdd8c9d394887608d1d8117d5be8184/packages/sst/src/runtime/handlers/node.ts#L235, "npm install" is executed regardless of whether externals exist.
The check should read
if (input.mode === "deploy" && installPackages.length > 0)
Due to an incorrect check for a non-empty array here https://github.com/sst/v2/blob/49df4ace0bdd8c9d394887608d1d8117d5be8184/packages/sst/src/runtime/handlers/node.ts#L235, "npm install" is executed regardless of whether externals exist.
The check should read