Angular2 构建错误 TS2305 [英] Angular2 build error TS2305
问题描述
我尝试在 .NET 项目中的 angular2 项目上运行构建(我认为这部分无关紧要).
我在构建项目时遇到以下错误.已经尝试删除typings目录,然后不做任何更改地安装typings.
<块引用>Package.json
<代码>{"name": "angular2project","版本": "1.0.0","许可证": "麻省理工学院",角度cli":{},脚本":{"start": "ng serve","lint": "ng lint","test": "ng 测试","pree2e": "webdriver-manager 更新","e2e": "量角器","clean": "rimraf -- wwwroot","postclean": "ng build","prebuild": "npm run clean","build": "dotnet 构建","clean:prod": "rimraf -- wwwroot","postclean:prod": "ng build --prod","prebuild:prod": "npm run clean:prod","build:prod": "dotnet publish -c release"},私人":真的,依赖关系":{"@angular/common": "~2.0.0","@angular/compiler": "~2.0.0","@angular/core": "~2.0.0","@angular/forms": "~2.0.0","@angular/http": "~2.0.0","@angular/platform-browser": "~2.0.0","@angular/platform-browser-dynamic": "~2.0.0","@angular/router": "~3.0.0","core-js": "^2.4.1","ng2-datepicker": "^1.1.1","rxjs": "5.0.0-beta.12","ts-helpers": "^1.1.1",zone.js":^0.6.23"},开发依赖":{"@types/jasmine": "^2.2.30","@types/node": "^6.0.42","angular-cli": "1.0.0-beta.17","codelyzer": "~0.0.26","jasmine-core": "2.4.1","jasmine-spec-reporter": "2.5.0","业力": "1.2.0","karma-chrome-launcher": "^2.0.0","karma-cli": "^1.0.1","karma-firefox-launcher": "^1.0.0","karma-ie-launcher": "^1.0.0","karma-jasmine": "^1.0.2","karma-phantomjs-launcher": "^1.0.2","karma-remap-istanbul": "^0.2.1","karma-safari-launcher": "^1.0.0","量角器": "4.0.9","rimraf": "^2.5.4","ts-node": "1.2.1","tslint": "3.13.0",打字稿":2.0.2"},-vs-绑定":{建造前":[建造"]}}
<块引用>
Angular-cli.json
<代码>{项目": {"版本": "1.0.0-beta.16",名称":角度管理员"},应用": [{"root": "src","outDir": "wwwroot","assets": "资产","index": "index.html","main": "main.ts","test": "test.ts","tsconfig": "tsconfig.json",前缀":应用程序",移动":假,风格":[样式.css"],脚本":[],环境":{"source": "环境/environment.ts","dev": "环境/environment.ts","prod": "环境/environment.prod.ts"}}],插件":[],包":[],e2e":{量角器":{配置":./protractor.conf.js"}},测试": {业力":{配置":./karma.conf.js"}},默认值":{"styleExt": "css",前缀接口":假}}
<块引用>
错误输出
1>------ 构建开始:项目:Angular2,配置:调试任何 CPU ------1>C:\Angular2\e2e\base.po.ts(1,10): error TS2305: Build:Module ''protractor'' has no export member 'browser'.1>C:\Angular2\e2e\base.po.ts(1,19): 错误 TS2305: Build:Module ''protractor'' 没有导出成员 'element'.1>C:\Angular2\e2e\base.po.ts(1,28): 错误 TS2305: Build:Module ''protractor'' 没有导出成员 'by'.1>C:\Angular2\e2e\base.po.ts(1,32): 错误 TS2305: Build:Module ''protractor'' 没有导出成员 'ProtractorBrowser'.1>C:\Angular2\node_modules\@types\jasmine\index.d.ts(74,9): 错误 TS2375: Build:Duplicate number index signature.1>C:\Angular2\node_modules\@types\jasmine\index.d.ts(129,9):错误 TS2374:构建:重复字符串索引签名.1>C:\Angular2\node_modules\@types\node\index.d.ts(70,5): 错误 TS2403: Build:Subsequent variable declarations must have the same type.变量main"必须是any"类型,但这里的类型是NodeModule".1>C:\Angular2\node_modules\@types\node\index.d.ts(81,5): error TS2403: Build:Subsequent variable declarations must have the same type.变量parent"的类型必须是any",但这里的类型是NodeModule".1>C:\Angular2\node_modules\@types\node\index.d.ts(82,5): 错误 TS2403: Build:Subsequent variable declarations must have the same type.变量children"必须是any[]"类型,但这里的类型是NodeModule[]".1>C:\Angular2\node_modules\@types\node\index.d.ts(102,6): 错误 TS2300: Build:Duplicate identifier 'BufferEncoding'.1>C:\Angular2\node_modules\@types\node\index.d.ts(553,26):错误 TS2300:构建:重复标识符缓冲区".1>C:\Angular2\node_modules\@types\node\index.d.ts(553,50): 错误 TS2300: Build:Duplicate identifier 'SlowBuffer'.1>C:\Angular2\node_modules\@types\node\index.d.ts(597,5): error TS2309: Build:An export assignment不能用于具有其他导出元素的模块.1>C:\Angular2\node_modules\@types\node\index.d.ts(742,18):错误 TS2300:构建:重复标识符代理".1>C:\Angular2\node_modules\@types\node\index.d.ts(797,9): 错误 TS2403: Build:Subsequent variable declarations must have the same type.变量 'addressType' 必须是 'string' 类型,但这里的类型是 'number |"udp4" |udp6"'.1>C:\Angular2\node_modules\@types\node\index.d.ts(800,18): 错误 TS2300: Build:Duplicate identifier 'Worker'.1>C:\Angular2\node_modules\@types\node\index.d.ts(1281,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'SNICallback' 的类型必须是 '(servername: string) =>any',但这里有类型 '(servername: string, cb: (err: Error, ctx: SecureContext) => any) =>任何'.1>C:\Angular2\node_modules\@types\node\index.d.ts(1481,17): 错误 TS2300: Build:Duplicate identifier 'CompleterResult'.1>C:\Angular2\node_modules\@types\node\index.d.ts(1518,18):错误 TS2300:构建:重复标识符脚本".1>C:\Angular2\node_modules\@types\node\index.d.ts(2770,16): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'StringDecoder' 的类型必须是 'new (encoding: string) =>NodeStringDecoder',但这里有类型 'new (encoding?: string) =>NodeStringDecoder'.1>C:\Angular2\node_modules\@types\node\index.d.ts(2821,18): 错误 TS2300: Build:Duplicate identifier 'TLSSocket'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3018,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'pfx' 的类型必须是 'any',但这里的类型是 'string |缓冲[]'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3019,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'key' 的类型必须是 'any',但这里的类型是 'string |任何[] |字符串[] |缓冲'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3021,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'cert' 的类型必须是 'any',但这里的类型是 'string |字符串[] |缓冲区 |缓冲[]'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3022,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'ca' 的类型必须是 'any',但这里的类型是 'string |字符串[] |缓冲区 |缓冲[]'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3023,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'crl' 的类型必须是 'any',但这里的类型是 'string |细绳[]'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3025,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量honorCipherOrder"必须是any"类型,但这里的类型是boolean".1>C:\Angular2\node_modules\@types\node\index.d.ts(3028,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'NPNProtocols' 的类型必须是 'any',但这里的类型是 'string[] |缓冲'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3029,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'SNICallback' 的类型必须是 '(servername: string) =>any',但这里有类型 '(servername: string, cb: (err: Error, ctx: SecureContext) => any) =>任何'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3045,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'key' 的类型必须是 'string |Buffer',但这里有类型 'string |字符串[] |缓冲区 |缓冲[]'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3047,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'cert' 的类型必须是 'string |Buffer',但这里有类型 'string |字符串[] |缓冲区 |缓冲[]'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3048,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'ca' 的类型必须是 '(string | Buffer)[]',但这里的类型是 'string |缓冲区 |(字符串 | 缓冲区)[]'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3287,9): 错误 TS2403: Build:Subsequent variable declarations must have the same type.变量 'padding' 必须是 'any' 类型,但这里的类型是 'number'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3292,9): error TS2403: Build:Subsequent variable declarations must have the same type.变量 'padding' 必须是 'any' 类型,但这里的类型是 'number'.1>C:\Angular2\node_modules\@types\node\index.d.ts(3550,5): error TS2309: Build:An export assignment不能用于具有其他导出元素的模块.1>C:\Angular2\node_modules\@types\node\index.d.ts(3633,5): 错误 TS2300: Build:Duplicate identifier 'export='.1>C:\Angular2\node_modules\@types\node\index.d.ts(3655,18):错误 TS2300:构建:重复标识符域".1>C:\Angular2\node_modules\protractor\built\browser.d.ts(2,76): 错误 TS2305: Build:Module ''selenium-webdriver'' 没有导出成员 'Options'.1>C:\Angular2\node_modules\protractor\built\browser.d.ts(2,116): 错误 TS2305: Build:Module ''selenium-webdriver'' 没有导出成员 'TargetLocator'.1>C:\Angular2\node_modules\protractor\built\locators.d.ts(4,39): 错误 TS2304: Build:Cannot find name 'By'.1>C:\Angular2\node_modules\protractor\built\locators.d.ts(5,27): 错误 TS2304: Build:Cannot find name 'By'.1>C:\Angular2\node_modules\protractor\built\locators.d.ts(6,25): 错误 TS2304: Build:Cannot find name 'By'.1>C:\Angular2\node_modules\protractor\built\locators.d.ts(7,37): 错误 TS2304: Build:Cannot find name 'By'.1>C:\Angular2\node_modules\protractor\built\locators.d.ts(8,25): 错误 TS2304: Build:Cannot find name 'By'.1>C:\Angular2\node_modules\protractor\built\locators.d.ts(9,29): 错误 TS2304: Build:Cannot find name 'By'.1>C:\Angular2\node_modules\protractor\built\locators.d.ts(10,47): 错误 TS2304: Build:Cannot find name 'By'.1>C:\Angular2\node_modules\protractor\built\locators.d.ts(11,35): 错误 TS2304: Build:Cannot find name 'By'.1> C:\Angular2\node_modules\protractor\built\locators.d.ts(12,31): 错误 TS2304: Build:Cannot find name 'By'.1>C:\Angular2\src\app\app.service.ts(2,26): 错误 TS2307: Build:Cannot find module 'angular2-hmr'.1>C:\Angular2\src\main.browser.ts(1,10): error TS2305: Build:Module '"C:/Angular2/node_modules/@angular/platform-browser-dynamic/index"' 没有导出成员浏览器动态平台".1>C:\Angular2\typings\globals\node\index.d.ts(78,6): 错误 TS2300: Build:Duplicate identifier 'BufferEncoding'.1>C:\Angular2\typings\globals\node\index.d.ts(503,9): 错误 TS2502: Build:'BuffType' 在它自己的类型注释中被直接或间接引用.1>C:\Angular2\typings\globals\node\index.d.ts(504,9): error TS2502: Build:'SlowBuffType' 在它自己的类型注释中被直接或间接引用.1>C:\Angular2\typings\globals\node\index.d.ts(505,26):错误 TS2300:构建:重复标识符缓冲区".1> C:\Angular2\typings\globals\node\index.d.ts(505,50): 错误 TS2300: Build:Duplicate identifier 'SlowBuffer'.1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' 不能同时扩展类型 'EventEmitter' 和 'Server'.1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' 不能同时扩展类型 'EventEmitter' 和 'Server'.1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' 不能同时扩展类型 'EventEmitter' 和 'Server'.1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' 不能同时扩展类型 'EventEmitter' 和 'Server'.1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' 不能同时扩展类型 'EventEmitter' 和 'Server'.1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' 不能同时扩展类型 'EventEmitter' 和 'Server'.1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' 不能同时扩展类型 'EventEmitter' 和 'Server'.1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(578,22): 错误 TS2320: Build:Interface 'ServerResponse' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(606,22): 错误 TS2320: Build:Interface 'ClientRequest' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(606,22): 错误 TS2320: Build:Interface 'ClientRequest' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(606,22): 错误 TS2320: Build:Interface 'ClientRequest' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(606,22): 错误 TS2320: Build:Interface 'ClientRequest' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(606,22): 错误 TS2320: Build:Interface 'ClientRequest' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(606,22): 错误 TS2320: Build:Interface 'ClientRequest' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(606,22): 错误 TS2320: Build:Interface 'ClientRequest' 不能同时扩展类型 'EventEmitter' 和 'Writable'.1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' 不能同时扩展类型 'EventEmitter' 和 'Readable'.1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' 不能同时扩展类型 'EventEmitter' 和 'Readable'.1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' 不能同时扩展类型 'EventEmitter' 和 'Readable'.1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' 不能同时扩展类型 'EventEmitter' 和 'Readable'.1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' 不能同时扩展类型 'EventEmitter' 和 'Readable'.1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' 不能同时扩展类型 'EventEmitter' 和 'Readable'.1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' 不能同时扩展类型 'EventEmitter' 和 'Readable'.1>C:\Angular2\typings\globals\node\index.d.ts(682,18):错误 TS2300:构建:重复标识符代理".1>C:\Angular2\typings\globals\node\index.d.ts(727,18): 错误 TS2300: Build:Duplicate identifier 'Worker'.1>C:\Angular2\typings\globals\node\index.d.ts(980,22): 错误 TS2300: Build:Duplicate identifier 'CompleterResult'.1>C:\Angular2\typings\globals\node\index.d.ts(1020,18):错误 TS2300:构建:重复标识符脚本".1>C:\Angular2\typings\globals\node\index.d.ts(1298,22): 错误 TS2320: Build:Interface 'Server' 不能同时扩展类型 'Socket' 和 'EventEmitter'.1>C:\Angular2\typings\globals\node\index.d.ts(1861,18): 错误 TS2300: Build:Duplicate identifier 'TLSSocket'.1>C:\Angular2\typings\globals\node\index.d.ts(2159,18): 错误 TS2420: Build:Class 'Readable' 错误地实现了接口 'ReadableStream'.1>C:\Angular2\typings\globals\node\index.d.ts(2196,18): 错误 TS2420: Build:Class 'Duplex' 错误地实现了接口 'ReadWriteStream'.1>C:\Angular2\typings\globals\node\index.d.ts(2210,18): 错误 TS2420: Build:Class 'Transform' 错误地实现了接口 'ReadWriteStream'.1>C:\Angular2\typings\globals\node\index.d.ts(2301,5): 错误 TS2300: Build:Duplicate identifier 'export='.1>C:\Angular2\typings\globals\node\index.d.ts(2323,18):错误 TS2300:构建:重复标识符域".========== 构建:0 成功,1 失败,0 最新,0 跳过 ==========
评论太长:
我只是喜欢一个 angular-cli package.json,我看到了一些不同之处.注意@angular/compiler-cli 的导入.这是一个猜测,但编译器"和您的所有类型问题都可能相关.也许你的版本是旧的/关闭的(我在你的脚本中看到 @angular/compiler 而不是 compiler-cli 等).
(更改帖子以包含整个 package.json 内容):
<代码>{"name": "我的网站",版本":0.0.0","许可证": "麻省理工学院",角度cli":{},脚本":{"start": "ng serve","lint": "tslint \"src/**/*.ts\"","test": "ng 测试","pree2e": "webdriver-manager 更新","e2e": "量角器"},私人":真的,依赖关系":{"@angular/common": "^2.1.0","@angular/compiler": "^2.1.0","@angular/core": "^2.1.0","@angular/forms": "^2.1.0","@angular/http": "^2.1.0","@angular/platform-browser": "^2.1.0","@angular/platform-browser-dynamic": "^2.1.0","@angular/router": "^3.1.0","core-js": "^2.4.1","rxjs": "5.0.0-beta.12","ts-helpers": "^1.1.1",zone.js":^0.6.23"},开发依赖":{"@angular/compiler-cli": "^2.1.0","@types/jasmine": "^2.2.30","@types/node": "^6.0.42","angular-cli": "1.0.0-beta.20-4","codelyzer": "~1.0.0-beta.3","jasmine-core": "2.4.1","jasmine-spec-reporter": "2.5.0","业力": "1.2.0","karma-chrome-launcher": "^2.0.0","karma-cli": "^1.0.1","karma-jasmine": "^1.0.2","karma-remap-istanbul": "^0.2.1","量角器": "4.0.9","ts-node": "1.2.1","tslint": "3.13.0","打字稿": "~2.0.3",webdriver-manager":10.2.5"}}
I tried to run build on an angular2 project, inside a .NET project (this part doesn't matter a lot i think).
I encounter the following error when building my project. Already tried to delete typings directory and then do typings install with no change.
Package.json
{
"name": "angular2project",
"version": "1.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "ng lint",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor",
"clean": "rimraf -- wwwroot",
"postclean": "ng build",
"prebuild": "npm run clean",
"build": "dotnet build",
"clean:prod": "rimraf -- wwwroot",
"postclean:prod": "ng build --prod",
"prebuild:prod": "npm run clean:prod",
"build:prod": "dotnet publish -c release"
},
"private": true,
"dependencies": {
"@angular/common": "~2.0.0",
"@angular/compiler": "~2.0.0",
"@angular/core": "~2.0.0",
"@angular/forms": "~2.0.0",
"@angular/http": "~2.0.0",
"@angular/platform-browser": "~2.0.0",
"@angular/platform-browser-dynamic": "~2.0.0",
"@angular/router": "~3.0.0",
"core-js": "^2.4.1",
"ng2-datepicker": "^1.1.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@types/jasmine": "^2.2.30",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.17",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-firefox-launcher": "^1.0.0",
"karma-ie-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"karma-safari-launcher": "^1.0.0",
"protractor": "4.0.9",
"rimraf": "^2.5.4",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2"
},
"-vs-binding": {
"BeforeBuild": [
"build"
]
}
}
Angular-cli.json
{
"project": {
"version": "1.0.0-beta.16",
"name": "angular-admin"
},
"apps": [
{
"root": "src",
"outDir": "wwwroot",
"assets": "assets",
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"styles.css"
],
"scripts": [],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [],
"packages": [],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"prefixInterfaces": false
}
}
Error Output
1>------ Build started: Project: Angular2, Configuration: Debug Any CPU ------
1>C:\Angular2\e2e\base.po.ts(1,10): error TS2305: Build:Module ''protractor'' has no exported member 'browser'.
1>C:\Angular2\e2e\base.po.ts(1,19): error TS2305: Build:Module ''protractor'' has no exported member 'element'.
1>C:\Angular2\e2e\base.po.ts(1,28): error TS2305: Build:Module ''protractor'' has no exported member 'by'.
1>C:\Angular2\e2e\base.po.ts(1,32): error TS2305: Build:Module ''protractor'' has no exported member 'ProtractorBrowser'.
1>C:\Angular2\node_modules\@types\jasmine\index.d.ts(74,9): error TS2375: Build:Duplicate number index signature.
1>C:\Angular2\node_modules\@types\jasmine\index.d.ts(129,9): error TS2374: Build:Duplicate string index signature.
1>C:\Angular2\node_modules\@types\node\index.d.ts(70,5): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'main' must be of type 'any', but here has type 'NodeModule'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(81,5): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'parent' must be of type 'any', but here has type 'NodeModule'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(82,5): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'children' must be of type 'any[]', but here has type 'NodeModule[]'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(102,6): error TS2300: Build:Duplicate identifier 'BufferEncoding'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(553,26): error TS2300: Build:Duplicate identifier 'Buffer'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(553,50): error TS2300: Build:Duplicate identifier 'SlowBuffer'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(597,5): error TS2309: Build:An export assignment cannot be used in a module with other exported elements.
1>C:\Angular2\node_modules\@types\node\index.d.ts(742,18): error TS2300: Build:Duplicate identifier 'Agent'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(797,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'addressType' must be of type 'string', but here has type 'number | "udp4" | "udp6"'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(800,18): error TS2300: Build:Duplicate identifier 'Worker'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(1281,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'SNICallback' must be of type '(servername: string) => any', but here has type '(servername: string, cb: (err: Error, ctx: SecureContext) => any) => any'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(1481,17): error TS2300: Build:Duplicate identifier 'CompleterResult'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(1518,18): error TS2300: Build:Duplicate identifier 'Script'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(2770,16): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'StringDecoder' must be of type 'new (encoding: string) => NodeStringDecoder', but here has type 'new (encoding?: string) => NodeStringDecoder'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(2821,18): error TS2300: Build:Duplicate identifier 'TLSSocket'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3018,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'pfx' must be of type 'any', but here has type 'string | Buffer[]'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3019,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'key' must be of type 'any', but here has type 'string | any[] | string[] | Buffer'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3021,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'cert' must be of type 'any', but here has type 'string | string[] | Buffer | Buffer[]'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3022,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'ca' must be of type 'any', but here has type 'string | string[] | Buffer | Buffer[]'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3023,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'crl' must be of type 'any', but here has type 'string | string[]'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3025,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'honorCipherOrder' must be of type 'any', but here has type 'boolean'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3028,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'NPNProtocols' must be of type 'any', but here has type 'string[] | Buffer'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3029,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'SNICallback' must be of type '(servername: string) => any', but here has type '(servername: string, cb: (err: Error, ctx: SecureContext) => any) => any'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3045,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'key' must be of type 'string | Buffer', but here has type 'string | string[] | Buffer | Buffer[]'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3047,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'cert' must be of type 'string | Buffer', but here has type 'string | string[] | Buffer | Buffer[]'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3048,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'ca' must be of type '(string | Buffer)[]', but here has type 'string | Buffer | (string | Buffer)[]'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3287,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'padding' must be of type 'any', but here has type 'number'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3292,9): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'padding' must be of type 'any', but here has type 'number'.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3550,5): error TS2309: Build:An export assignment cannot be used in a module with other exported elements.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3633,5): error TS2300: Build:Duplicate identifier 'export='.
1>C:\Angular2\node_modules\@types\node\index.d.ts(3655,18): error TS2300: Build:Duplicate identifier 'Domain'.
1>C:\Angular2\node_modules\protractor\built\browser.d.ts(2,76): error TS2305: Build:Module ''selenium-webdriver'' has no exported member 'Options'.
1>C:\Angular2\node_modules\protractor\built\browser.d.ts(2,116): error TS2305: Build:Module ''selenium-webdriver'' has no exported member 'TargetLocator'.
1>C:\Angular2\node_modules\protractor\built\locators.d.ts(4,39): error TS2304: Build:Cannot find name 'By'.
1>C:\Angular2\node_modules\protractor\built\locators.d.ts(5,27): error TS2304: Build:Cannot find name 'By'.
1>C:\Angular2\node_modules\protractor\built\locators.d.ts(6,25): error TS2304: Build:Cannot find name 'By'.
1>C:\Angular2\node_modules\protractor\built\locators.d.ts(7,37): error TS2304: Build:Cannot find name 'By'.
1>C:\Angular2\node_modules\protractor\built\locators.d.ts(8,25): error TS2304: Build:Cannot find name 'By'.
1>C:\Angular2\node_modules\protractor\built\locators.d.ts(9,29): error TS2304: Build:Cannot find name 'By'.
1>C:\Angular2\node_modules\protractor\built\locators.d.ts(10,47): error TS2304: Build:Cannot find name 'By'.
1>C:\Angular2\node_modules\protractor\built\locators.d.ts(11,35): error TS2304: Build:Cannot find name 'By'.
1>C:\Angular2\node_modules\protractor\built\locators.d.ts(12,31): error TS2304: Build:Cannot find name 'By'.
1>C:\Angular2\src\app\app.service.ts(2,26): error TS2307: Build:Cannot find module 'angular2-hmr'.
1>C:\Angular2\src\main.browser.ts(1,10): error TS2305: Build:Module '"C:/Angular2/node_modules/@angular/platform-browser-dynamic/index"' has no exported member 'browserDynamicPlatform'.
1>C:\Angular2\typings\globals\node\index.d.ts(78,6): error TS2300: Build:Duplicate identifier 'BufferEncoding'.
1>C:\Angular2\typings\globals\node\index.d.ts(503,9): error TS2502: Build:'BuffType' is referenced directly or indirectly in its own type annotation.
1>C:\Angular2\typings\globals\node\index.d.ts(504,9): error TS2502: Build:'SlowBuffType' is referenced directly or indirectly in its own type annotation.
1>C:\Angular2\typings\globals\node\index.d.ts(505,26): error TS2300: Build:Duplicate identifier 'Buffer'.
1>C:\Angular2\typings\globals\node\index.d.ts(505,50): error TS2300: Build:Duplicate identifier 'SlowBuffer'.
1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
1>C:\Angular2\typings\globals\node\index.d.ts(567,22): error TS2320: Build:Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(578,22): error TS2320: Build:Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(606,22): error TS2320: Build:Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(606,22): error TS2320: Build:Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(606,22): error TS2320: Build:Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(606,22): error TS2320: Build:Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(606,22): error TS2320: Build:Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(606,22): error TS2320: Build:Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(606,22): error TS2320: Build:Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
1>C:\Angular2\typings\globals\node\index.d.ts(632,22): error TS2320: Build:Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
1>C:\Angular2\typings\globals\node\index.d.ts(682,18): error TS2300: Build:Duplicate identifier 'Agent'.
1>C:\Angular2\typings\globals\node\index.d.ts(727,18): error TS2300: Build:Duplicate identifier 'Worker'.
1>C:\Angular2\typings\globals\node\index.d.ts(980,22): error TS2300: Build:Duplicate identifier 'CompleterResult'.
1>C:\Angular2\typings\globals\node\index.d.ts(1020,18): error TS2300: Build:Duplicate identifier 'Script'.
1>C:\Angular2\typings\globals\node\index.d.ts(1298,22): error TS2320: Build:Interface 'Server' cannot simultaneously extend types 'Socket' and 'EventEmitter'.
1>C:\Angular2\typings\globals\node\index.d.ts(1861,18): error TS2300: Build:Duplicate identifier 'TLSSocket'.
1>C:\Angular2\typings\globals\node\index.d.ts(2159,18): error TS2420: Build:Class 'Readable' incorrectly implements interface 'ReadableStream'.
1>C:\Angular2\typings\globals\node\index.d.ts(2196,18): error TS2420: Build:Class 'Duplex' incorrectly implements interface 'ReadWriteStream'.
1>C:\Angular2\typings\globals\node\index.d.ts(2210,18): error TS2420: Build:Class 'Transform' incorrectly implements interface 'ReadWriteStream'.
1>C:\Angular2\typings\globals\node\index.d.ts(2301,5): error TS2300: Build:Duplicate identifier 'export='.
1>C:\Angular2\typings\globals\node\index.d.ts(2323,18): error TS2300: Build:Duplicate identifier 'Domain'. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Too long for a comment:
I just took a like at an angular-cli package.json, and I see some differences. Note the import of @angular/compiler-cli. It's a guess, but "compiler" and all your problems with types could be related. Maybe your versions are old/off (I see in your script @angular/compiler instead of compiler-cli, etc).
(Changed post to include the whole package.json contents):
{
"name": "my-website",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "^2.1.0",
"@angular/compiler": "^2.1.0",
"@angular/core": "^2.1.0",
"@angular/forms": "^2.1.0",
"@angular/http": "^2.1.0",
"@angular/platform-browser": "^2.1.0",
"@angular/platform-browser-dynamic": "^2.1.0",
"@angular/router": "^3.1.0",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@angular/compiler-cli": "^2.1.0",
"@types/jasmine": "^2.2.30",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.20-4",
"codelyzer": "~1.0.0-beta.3",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "~2.0.3",
"webdriver-manager": "10.2.5"
}
}
这篇关于Angular2 构建错误 TS2305的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!