简体   繁体   English

Angular 4:先前正在运行的github项目的本地版本出错

[英]Angular 4: Error on local build of github project that was previously working

So I have a project on github and I was trying to upgrade to Angular 5.. which at first seemed to have worked, but later I discovered weird bugs and wanted to just continue working with what was working in the last commit.. back to Angular 4.. but when I tried to build the project I keep getting this error: 所以我在github上有一个项目,我试图升级到Angular 5.。起初似乎起作用,但是后来我发现了怪异的bug,只想继续使用上一次提交中的工作。 Angular 4 ..但是当我尝试构建项目时,我不断收到此错误:

ERROR in /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (232,41): ',' expected.)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (233,41): ',' expected.)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1252,41): ',' expected.)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1253,41): ',' expected.)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1972,55): ',' expected.)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1976,54): ',' expected.)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1986,55): ',' expected.)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1991,57): ',' expected.)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (2005,48): ',' expected.)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (2088,22): ',' expected.)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (232,94): Generic type 'IDirectiveFactory<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (233,96): Generic type 'IDirectiveFactory<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1252,94): Generic type 'IDirectiveFactory<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1253,96): Generic type 'IDirectiveFactory<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1973,27): Generic type 'IDirective<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1973,48): Generic type 'IDirectiveLinkFn<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1987,15): Generic type 'IDirectiveLinkFn<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (1988,16): Generic type 'IDirectiveLinkFn<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (2002,19): Generic type 'IDirectiveLinkFn<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (2002,46): Generic type 'IDirectivePrePost<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (2006,19): Generic type 'IDirectiveCompileFn<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (2015,16): Generic type 'IDirectiveLinkFn<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (2015,43): Generic type 'IDirectivePrePost<TScope, IScope>' requires 2 type argument(s).)
    /Users/lsorensen/code/OneUnionV1/node_modules/@types/angular/index.d.ts (2088,24): Type parameter name cannot be 'any')
npm ERR! code ELIFECYCLE

package.json 的package.json

{
  "name": "TheOneUnion",
  "version": "1.0.0",
  "main": "index.js",
  "repository": {},
  "scripts": {
    "start": "npm run build && npm run server",
    "build": "webpack --progress --color",
    "build:aot": "webpack --env.aot --env.client & webpack --env.aot --env.server",
    "build:prod": "webpack --env.aot --env.client -p & webpack --env.aot --env.server",
    "prebuild": "npm run clean",
    "prebuild:aot": "npm run clean",
    "prebuild:prod": "npm run clean",
    "clean": "rimraf dist",
    "server": "nodemon dist/server.js",
    "watch": "webpack --watch",
    "watch:dev": "npm run server & npm run watch",
    "debug:server": "node-nightly --inspect --debug-brk dist/server.js & webpack --watch"
  },
  "engines": {
    "node": ">=6.0.0"
  },
  "license": "MIT",
  "dependencies": {
    "@agm/core": "1.0.0-beta.0",
    "@angular/animations": "4.4.3",
    "@angular/cdk": "2.0.0-beta.11",
    "@angular/common": "4.4.3",
    "@angular/core": "4.4.3",
    "@angular/forms": "4.4.3",
    "@angular/http": "4.4.3",
    "@angular/material": "2.0.0-beta.11",
    "@angular/platform-browser": "4.4.3",
    "@angular/platform-browser-dynamic": "4.4.3",
    "@angular/platform-server": "4.4.3",
    "@angular/router": "4.4.3",
    "@nguniversal/express-engine": "1.0.0-beta.2",
    "@types/mongodb": "2.2.0",
    "angular2-jwt": "0.2.0",
    "autoprefixer": "6.7.6",
    "aws-sdk": "2.23.0",
    "base64url": "2.0.0",
    "bcrypt-nodejs": "0.0.3",
    "bluebird": "3.5.0",
    "body-parser": "1.17.1",
    "bootstrap-sass": "3.3.7",
    "compression": "1.6.2",
    "crypto": "0.0.3",
    "css-loader": "0.25.0",
    "css-to-string-loader": "0.1.2",
    "debug": "2.6.8",
    "elasticsearch": "12.1.3",
    "evaporate": "2.0.9",
    "express": "4.15.2",
    "extract-text-webpack-plugin": "2.1.0",
    "global": "4.3.2",
    "gm": "1.23.0",
    "hammerjs": "2.0.8",
    "html-metadata": "^1.6.3",
    "imports-loader": "0.7.1",
    "js.clone": "0.0.3",
    "jsonwebtoken": "7.3.0",
    "lodash": "4.17.4",
    "log4js": "1.1.1",
    "methods": "1.1.2",
    "minilog": "3.1.0",
    "moment": "2.18.1",
    "mongoose": "4.11.4",
    "morgan": "1.8.1",
    "ng2-facebook-sdk": "2.3.1",
    "node-ffprobe": "1.2.2",
    "node-sass": "4.5.0",
    "nodemailer": "4.1.0",
    "normalize.css": "7.0.0",
    "postcss-loader": "1.3.3",
    "preboot": "4.5.2",
    "request": "2.80.0",
    "rxjs": "5.3.0",
    "sass-loader": "6.0.2",
    "webfontloader": "1.6.27",
    "xhr2": "0.1.4",
    "zone.js": "0.8.8"
  },
  "devDependencies": {
    "@angular/compiler": "4.4.3",
    "@angular/compiler-cli": "4.4.3",
    "@angular/core": "4.4.3",
    "@ngtools/webpack": "1.2.14",
    "@types/angular-material": "1.1.54",
    "@types/aws-sdk": "0.0.42",
    "@types/base64url": "2.0.3",
    "@types/bluebird": "3.5.3",
    "@types/body-parser": "0.0.34",
    "@types/compression": "0.0.33",
    "@types/cookie-parser": "1.3.30",
    "@types/elasticsearch": "5.0.12",
    "@types/evaporate": "0.0.18",
    "@types/express": "4.0.35",
    "@types/express-serve-static-core": "4.0.40",
    "@types/gm": "1.17.29",
    "@types/googlemaps": "^3.29.1",
    "@types/hammerjs": "2.0.34",
    "@types/jasmine": "2.5.43",
    "@types/jasminewd2": "2.0.1",
    "@types/jsonwebtoken": "7.2.0",
    "@types/lodash": "4.14.54",
    "@types/mime": "0.0.29",
    "@types/mongoose": "4.7.19",
    "@types/morgan": "1.7.32",
    "@types/node": "7.0.8",
    "@types/nodemailer": "1.3.32",
    "@types/request": "0.0.41",
    "@types/serve-static": "1.7.31",
    "@types/webfontloader": "1.6.28",
    "html-webpack-plugin": "2.28.0",
    "node-loader": "0.6.0",
    "nodemon": "1.11.0",
    "raw-loader": "0.5.1",
    "rimraf": "2.6.1",
    "script-ext-html-webpack-plugin": "1.7.1",
    "typescript": "2.5.3",
    "webpack": "3.5.5",
    "webpack-merge": "4.1.0",
    "webpack-node-externals": "1.6.0"
  }
}

the other developers working on the project have confirmed that they can run the build on the same branch I am fine... so it has to be a problem locally.. I've tried everything. 其他从事该项目的开发人员已经确认,他们可以在同一分支上运行构建,我很好。所以这一定是本地问题。我已经尝试了所有方法。 deleting it and recloning. 删除并重新克隆。 cleaning caches.. deleted and reinstalled node and all global packages as well as even reinstalling macOS... and still the same error. 清理缓存..删除并重新安装节点和所有全局软件包,甚至重新安装macOS ...,仍然是相同的错误。 If anyone has the slightest idea of what I can try I will be very thankful. 如果有人对我可以尝试的事情有一点想法,我将非常感激。

使用TypeScript 2.4.2和RxJS 5.4.2

I had the same issue. 我遇到过同样的问题。 The following worked for me: I've uninstalled typescript globally and from project folder (sudo npm uninstall -g typescript). 以下对我有用:我已经从项目文件夹中全局卸载了打字稿(sudo npm uninstall -g打字稿)。 Then installed typescript in project folder with --save-dev (sudo npm install --save-dev typescript@'>=2.1.0 <2.4.0'). 然后使用--save-dev在项目文件夹中安装打字稿(sudo npm install --save-dev typescript @'> = 2.1.0 <2.4.0')。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM