[英]error TS2693: 'Map' only refers to a type, but is being used as a value here
I am beginner on angular 2 so bear with me, I am watching this course Angular Fundamentals by Jim Cooper and Joe Eames 我是angular 2的初学者,请耐心等待,我正在看这门课程,作者是Jim Cooper和Joe Eames撰写的Angular基础知识
I downloaded the course materials on the getting started which should work but its full of errors: 我在入门中下载了课程材料,该材料应该可以使用,但其中包含很多错误:
The errors are not in my project files, are ratheter on node_modules. 错误不在我的项目文件中,而是在node_modules上。
I already did NPM Install. 我已经安装了NPM。
This is my package.json 这是我的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": {}
}
And the errors I got when I run npm start 运行npm时出现的错误开始
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'
If I check the log file, these are the contents: 如果我检查日志文件,则内容如下:
info it worked if it ends with 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.
看来,当您开始某些事情时想要使用一个对象的版本,而该对象的版本与您想要的版本并不相同..也许在这里看看它可能会有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.