【问题标题】:error TS2693: 'Map' only refers to a type, but is being used as a value here错误 TS2693:“映射”仅指一种类型,但在此处用作值
【发布时间】:2017-12-03 16:10:56
【问题描述】:

我是 Angular 2 的初学者,所以请耐心等待,我正在观看本课程 Jim Cooper 和 Joe Eames 的 Angular Fundamentals

我下载了入门的课程资料,应该可以工作,但它充满了错误:

错误不在我的项目文件中,而是在 node_modules 上。

我已经安装了 NPM。

这是我的 package.json

{
  "name": "ng2-fundamentals-demo",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run server\" ",
    "server": "node node_modules/ng2f-server/server.js",
    "tsc": "tsc",
    "tsc:w": "tsc -w"
  },
  "keywords": [],
  "author": "",
  "licenses": [
    {
      "type": "MIT",
      "url": "https://github.com/angular/angular.io/blob/master/LICENSE"
    }
  ],
  "dependencies": {
    "@angular/common": "~2.2.0",
    "@angular/compiler": "~2.2.0",
    "@angular/core": "~2.2.0",
    "@angular/forms": "~2.2.0",
    "@angular/http": "~2.2.0",
    "@angular/platform-browser": "~2.2.0",
    "@angular/platform-browser-dynamic": "~2.2.0",
    "@angular/router": "~3.2.0",
    "@angular/upgrade": "~2.2.0",
    "systemjs": "0.19.40",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "^0.6.26",
    "ng2f-bootstrap": "^0.0.4",
    "ng2f-server": "^0.2.3"
  },
  "devDependencies": {
    "concurrently": "^3.1.0",
    "typescript": "^2.0.3",
    "@types/core-js": "^0.9.34",
    "@types/node": "^6.0.46"
  },
  "repository": {}
}

以及我在运行 npm start 时遇到的错误

node_modules/@types/core-js/index.d.ts(2338,43): error TS2339: Property 'toStringTag' does not exist on type 'SymbolConstructor'
.
node_modules/@types/core-js/index.d.ts(2342,43): error TS2339: Property 'unscopables' does not exist on type 'SymbolConstructor'
.
node_modules/rxjs/Observable.d.ts(66,60): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
  Types of property 'lift' are incompatible.
    Type '<T, R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observa
ble<R>'.
      Type 'Observable<T>' is not assignable to type 'Observable<R>'.
        Type 'T' is not assignable to type 'R'

如果我检查日志文件,这些是内容:

如果它以 ok 结尾,它会起作用

1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@5.0.2
3 info using node@v6.10.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle ng2-fundamentals-demo@1.0.0~prestart: ng2-fundamentals-demo@1.0.0
6 silly lifecycle ng2-fundamentals-demo@1.0.0~prestart: no script for prestart, continuing
7 info lifecycle ng2-fundamentals-demo@1.0.0~start: ng2-fundamentals-demo@1.0.0
8 verbose lifecycle ng2-fundamentals-demo@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle ng2-fundamentals-demo@1.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Volumes/Test/One$
10 verbose lifecycle ng2-fundamentals-demo@1.0.0~start: CWD: /Volumes/Test/OneDrive - SE/Angular2Samples/angular-fundamentals/0$
11 silly lifecycle ng2-fundamentals-demo@1.0.0~start: Args: [ '-c',
11 silly lifecycle   'tsc && concurrently "npm run tsc:w" "npm run server" ' ]
12 silly lifecycle ng2-fundamentals-demo@1.0.0~start: Returned: code: 2  signal: null
13 info lifecycle ng2-fundamentals-demo@1.0.0~start: Failed to exec start script
14 verbose stack Error: ng2-fundamentals-demo@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run server" `
14 verbose stack Exit status 2
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:886:16
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid ng2-fundamentals-demo@1.0.0
16 verbose cwd /Volumes/Test/OneDrive - SE/Angular2Samples/angular-fundamentals/01-getting-started-with-angular/getting-started$
17 verbose Darwin 16.6.0
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 verbose node v6.10.3
20 verbose npm  v5.0.2
21 error code ELIFECYCLE
22 error errno 2
23 error ng2-fundamentals-demo@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run server" `
23 error Exit status 2
24 error Failed at the ng2-fundamentals-demo@1.0.0 start script.

【问题讨论】:

    标签: node.js angular typescript npm


    【解决方案1】:

    似乎当您开始某些事情时想要使用一个对象的版本,而您带来的版本与它想要的不同..也许看看here它可能会有所帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-24
      • 1970-01-01
      • 2018-08-07
      • 2020-04-28
      • 2021-08-23
      • 2020-12-05
      • 2018-03-31
      • 1970-01-01
      相关资源
      最近更新 更多