Angular 4:以前正在工作的github项目的本地构建出错

时间:2017-11-20 20:01:20

标签: node.js angular

所以我在github上有一个项目,我正在尝试升级到Angular 5 ..起初似乎有用了,但后来我发现了奇怪的错误,并希望继续使用最后一次提交的工作。回到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

{
  "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"
  }
}

其他开发项目的开发人员已经确认他们可以在同一个分支上运行构建我很好......所以它必须是本地问题..我已经尝试了一切。删除它并重新克隆。清理缓存..已删除并重新安装的节点和所有全局包以及重新安装macOS ......仍然是同样的错误。如果有人对我可以尝试的东西有任何想法,我会非常感激。

2 个答案:

答案 0 :(得分:2)

使用TypeScript 2.4.2和RxJS 5.4.2

答案 1 :(得分:1)

我有同样的问题。以下对我有用:我已经从全局和项目文件夹中卸载了打字稿(sudo npm uninstall -g typescript)。然后使用--save-dev在项目文件夹中安装typescript(sudo npm install --save-dev typescript @'&gt; = 2.1.0&lt; 2.4.0')。