以下是管道构建阶段发生的错误
found 0 vulnerabilities
[Container] 2023/11/01 09:50:54.339059 Running command npm run build
> [email protected] build
> tsc
**node_modules/@elastic/transport/lib/connection/HttpConnection.d.ts(3,8): error TS1192: Module '"/codebuild/output/src1897116248/src/node_modules/hpagent/index"' has no default export.
node_modules/@elastic/transport/lib/connection/HttpConnection.d.ts(4,8): error TS1192: Module '"http"' has no default export.
node_modules/@elastic/transport/lib/connection/HttpConnection.d.ts(5,8): error TS1192: Module '"https"' has no default export.
**
[Container] 2023/11/01 09:51:08.403663 Command did not exit successfully npm run build exit status 2
[Container] 2023/11/01 09:51:08.407098 Phase complete: BUILD State: FAILED
[Container] 2023/11/01 09:51:08.407124 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run build. Reason: exit status 2
[Container] 2023/11/01 09:51:08.453719 Entering phase POST_BUILD
[Container] 2023/11/01 09:51:08.455394 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2023/11/01 09:51:08.455406 Phase context status code: Message:
[Container] 2023/11/01 09:51:08.560643 Expanding base directory path: cdk.out
[Container] 2023/11/01 09:51:08.562579 Assembling file list
[Container] 2023/11/01 09:51:08.562592 Expanding cdk.out
[Container] 2023/11/01 09:51:08.564242 Skipping invalid file path cdk.out
[Container] 2023/11/01 09:51:08.564291 Phase complete: UPLOAD_ARTIFACTS State: FAILED
[Container] 2023/11/01 09:51:08.564300 Phase context status code: CLIENT_ERROR Message: no matching base directory path found for cdk.out
字符串
我已经使用AWS CDK设置了一个管道,并使用了一个nodeJS函数来创建一个lambda堆栈。但我被这个错误困在了构建阶段.
下面是我的源代码Lambda Stack
const db = new NodejsFunction(this, 'phpcall', {
bundling: {
nodeModules: ['axios', 'crypto', '@elastic/elasticsearch']
}
})
型
Lambda代码中的import语句
import { Client } from '@elastic/elasticsearch'
型
1条答案
按热度按时间wztqucjr1#
我通过在
tsconfig.json
文件中放入以下内容来修复上述问题:字符串