请告诉我发生了什么。 在构建项目时遇到以下错误。已经尝试删除typings,angular ,,目录,然后做typings安装没有变化。 安装他发誓的所有包裹。收到以下错误:
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"docker-build": "docker build -t ng2-quickstart .",
"docker": "npm run docker-build && docker run -it --rm -p 3000:3000 -p 3001:3001 ng2-quickstart",
"pree2e": "npm run webdriver:update",
"e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"postinstall": "typings install",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"test-once": "tsc && karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"webdriver:update": "webdriver-manager update"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/animations": "^4.2.4",
"@angular/common": "~4.0.0",
"@angular/compiler": "~4.0.0",
"@angular/core": "~4.0.0",
"@angular/forms": "~4.0.0",
"@angular/http": "~4.0.0",
"@angular/material": "^2.0.0-beta.7",
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~4.0.0",
"@types/q": "^1.0.1",
"angular": "^1.6.4",
"angular-animate": "^1.6.4",
"angular-aria": "^1.6.4",
"angular-in-memory-web-api": "~0.3.0",
"angular-material": "^1.1.4",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"material": "^0.1.1",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"typescript": "^2.4.1",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/flex-layout": "^2.0.0-beta.8",
"@types/hammerjs": "^2.0.34",
"@types/jasmine": "^2.5.53",
"@types/node": "^6.0.78",
"canonical-path": "0.0.2",
"concurrently": "^3.2.0",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"tslint": "^3.15.1"
},
"repository": {}
}
的package.json
{{1}}
答案 0 :(得分:0)
看起来您的npm安装已损坏。删除node_modules目录并再次运行npm install。
答案 1 :(得分:0)
您的错误是由于Typescript 2.4中的编译错误(请参阅Typescript 2.4 RxJS bug)
解决方案是在"typescript": "^2.4.1"
文件中将"typescript": "2.3.4"
更改为package.json
并重建您的项目。
我在离子项目中遇到了类似的错误,这个修复对我有用。
答案 2 :(得分:0)
我有类似的错误。将我的打字稿错误从 "打字稿":" ^ 2.4.1" 更改为 &#34 ;打字稿":" 2.2.1" ,错误消失了。
答案 3 :(得分:0)
看起来你有很多事情要发生,首先是rxjs和最新的打字稿版本已知问题(2.4.1应该有效,所以请将package.json固定到那个或做 what I suggest in the issue)。
此外,请确保@types/node
与您正在运行的节点版本相匹配。 npm install --save-dev @types/node
应该更新它。
其中一些错误可能是因为不兼容的包被放在一起。我建议破坏你的package.json,package-lock.json和node_modules文件夹,然后逐步npm install
只需要你的应用程序需要获取它们的最新版本。 (并对rxjs + typescript 2.4.x进行链接修复)