我试图在https://angular.io/docs/ts/latest/quickstart.html
之后设置我的机器以进行角度开发我已经到了必须运行“npm start”以实际启动我的网站的地步,但似乎打字稿编译失败了。
tsc版本:3.10.8 节点版本:6.6.0
> tsc
node_modules/@angular/common/src/localization.d.ts(4,1): error TS1128: Declaration or statement expected.
node_modules/@angular/common/src/localization.d.ts(4,16): error TS1005: ';' expected.
node_modules/@angular/common/src/localization.d.ts(4,25): error TS1005: ';' expected.
node_modules/@angular/common/src/localization.d.ts(5,14): error TS1005: '=' expected.
node_modules/@angular/common/src/localization.d.ts(5,37): error TS1005: ',' expected.
node_modules/@angular/common/src/localization.d.ts(5,43): error TS1005: ';' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(28,1): error TS1128: Declaration or statement expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(28,16): error TS1005: ';' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(28,25): error TS1005: ';' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(29,14): error TS1005: '=' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(29,31): error TS1109: Expression expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(29,41): error TS1005: ';' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(30,14): error TS1005: '=' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(30,41): error TS1005: ',' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(30,50): error TS1005: ';' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(31,14): error TS1005: '=' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(31,29): error TS1005: ',' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(31,41): error TS1005: ',' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(31,54): error TS1005: ',' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(31,75): error TS1005: ',' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(31,84): error TS1005: ';' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(32,14): error TS1005: '=' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(32,32): error TS1005: ',' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(32,44): error TS1005: ',' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(32,57): error TS1005: ',' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(32,78): error TS1005: ',' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(32,87): error TS1005: ';' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(33,14): error TS1005: '=' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(33,23): error TS1005: ';' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(34,14): error TS1005: '=' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(34,20): error TS1005: ';' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(35,14): error TS1005: '=' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(35,27): error TS1005: ',' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(35,52): error TS1005: ';' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(36,14): error TS1005: '=' expected.
node_modules/@angular/common/src/location/location_strategy.d.ts(36,27): error TS1005: ';' expected.
node_modules/@angular/common/src/location/platform_location.d.ts(34,1): error TS1128: Declaration or statement expected.
node_modules/@angular/common/src/location/platform_location.d.ts(34,16): error TS1005: ';' expected.
node_modules/@angular/common/src/location/platform_location.d.ts(34,25): error TS1005: ';' expected.
node_modules/@angular/common/src/location/platform_location.d.ts(35,14): error TS1005: '=' expected.
node_modules/@angular/common/src/location/platform_location.d.ts(35,34): error TS1005: ';' expected.
node_modules/@angular/common/src/location/platform_location.d.ts(36,14): error TS1005: '=' expected.
node_modules/@angular/common/src/location/platform_location.d.ts(36,27): error TS1005: ',' expected.
node_modules/@angular/common/src/location/platform_location.d.ts(36,52): error TS1005: ';' expected.
node_modules/@angular/common/src/location/platform_location.d.ts(37,14): error TS1005: '=' expected.
.... continues
node_modules/zone.js/lib/zone.ts(1110,89): error TS1134: Variable declaration expected.
/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:11654
node = node.parent;
^
TypeError: Cannot read property 'parent' of undefined
at appendOuterTypeParameters (/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:11654:28)
at getOuterTypeParametersOfClassOrInterface (/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:11670:20)
at getDeclaredTypeOfClassOrInterface (/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:11807:43)
at getDeclaredTypeOfSymbol (/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:11876:24)
at getTypeFromClassOrInterfaceReference (/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:12579:24)
at getTypeFromTypeReference (/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:12631:48)
at checkTypeReferenceNode (/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:16757:24)
at checkSourceElement (/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:18585:28)
at checkSignatureDeclaration (/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:16575:21)
at checkFunctionLikeDeclaration (/mnt/c/Users/mgj/Documents/makeitbro-angular2/node_modules/tsc/bin/tsc.js:17153:13)
npm ERR! Linux 3.4.0+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.6.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular2-quickstart@1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tsc && concurrently "npm run tsc:w" "npm run lite"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /mnt/c/Users/mgj/Documents/makeitbro-angular2/npm-debug.log
我的packages.json:
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"angular2-in-memory-web-api": "0.0.20",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.2.0",
"lite-server": "^2.2.2",
"typescript": "^2.0.2",
"typings": "^1.3.2"
}
}
答案 0 :(得分:1)
在npm install命令之后,你的项目中应该有typings文件夹
如果没有尝试以管理员身份运行npm install。
答案 1 :(得分:0)
您可以使用以下命令手动安装打字:
npm run typings install