我正在尝试将应用程序部署到弹性beantalk的NodeJs平台(10.15.3),但是在构建时(Node的命令为npm start --production
),我在日志中看到以下错误:
npm run build
app@1.0.0 build /var/app/current
tsc -p .
error TS2688: Cannot find type definition file for 'node'.
我的package.json是以下文件(它包含@ type / node:10.14):
{
"name": "app",
"version": "1.0.0",
"private": true,
"main": "dist/app.js",
"scripts": {
"build": "tsc -p .",
"prestart": "npm run build",
"watch": "tsc -w -p .",
"start": "node .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@types/morgan": "^1.7.35",
"@types/node": "^10.14",
"aws-sdk": "^2.411.0",
...
},
"devDependencies": {
"@types/express": "^4.16.1"
}
}
答案 0 :(得分:0)
您应将类型添加到tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "dist-api",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"types": ["node"]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
]
}