我使用
angular/universal-starter作为使用TypeScript 2和Webpack 2的启动器.
我添加了bluebird和nodemailer包.添加这些包和相关的类型后:
"@types/bluebird": "3.0.31",
"@types/nodemailer": "1.3.30",
它在终端给我这个错误:
ERROR in
/project/node_modules/@types/nodemailer/node_modules/@types/bluebird/index.d.ts
(772,5): error TS2300: Duplicate identifier ‘export=’.ERROR in /project/node_modules/@types/bluebird/index.d.ts (772,1):
error TS2300: Duplicate identifier ‘export=’.
[不确定是否有帮助]注意在安装@ types / nodemailer之后,@ type / nodemailer有自己的node_modules文件夹,包括@type / bluebird(这是一个旧的bluebird typings版本2.0.0):
我的tsconfig.json文件:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"module": "commonjs",
"removeComments": true,
"sourceMap": true,
"lib": ["es6", "dom"]
},
"include": [
"node_modules/@types/**/*.d.ts",
"src/**/*.ts"
],
"exclude": [
"node_modules",
"!node_modules/@types/**/*.d.ts"
],
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
我该如何解决这个错误?谢谢
最佳答案 不确定是什么原因造成的.但在将所有这些更新为新版本包后:
"bluebird": "3.4.1",
"nodemailer": "2.5.0",
"@types/bluebird": "3.0.32",
"@types/nodemailer": "1.3.31",
我没有改变任何其他代码.问题消失了.