angular.js - 为什么Angular2 Qucikstart,npm install老报错,npm start也运行不了?

查看:116
本文介绍了angular.js - 为什么Angular2 Qucikstart,npm install老报错,npm start也运行不了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

cmd窗口报错如下:

node_modules/@angular/common/src/facade/promise.d.ts(12,149): error TS2304: Cann
ot find name 'Promise'.
node_modules/@angular/common/src/facade/promise.d.ts(13,43): error TS2304: Canno
t find name 'Promise'.
node_modules/@angular/common/src/pipes/async_pipe.d.ts(34,38): error TS2304: Can
not find name 'Promise'.
node_modules/@angular/compiler/src/directive_normalizer.d.ts(12,62): error TS230
4: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/directive_normalizer.d.ts(13,95): error TS230
4: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/facade/lang.d.ts(4,17): error TS2304: Cannot
find name 'Map'.
node_modules/@angular/compiler/src/facade/lang.d.ts(5,17): error TS2304: Cannot
find name 'Set'.
node_modules/@angular/compiler/src/facade/lang.d.ts(71,59): error TS2304: Cannot
 find name 'Map'.
node_modules/@angular/compiler/src/offline_compiler.d.ts(32,70): error TS2304: C
annot find name 'Promise'.
node_modules/@angular/compiler/src/offline_compiler.d.ts(34,85): error TS2304: C
annot find name 'Promise'.
node_modules/@angular/compiler/src/output/output_ast.d.ts(417,63): error TS2304:
 Cannot find name 'Set'.
node_modules/@angular/compiler/src/runtime_compiler.d.ts(28,49): error TS2304: C
annot find name 'Promise'.
node_modules/@angular/compiler/src/template_parser.d.ts(37,12): error TS2304: Ca
nnot find name 'Set'.
node_modules/@angular/compiler/src/view_compiler/compile_view.d.ts(43,16): error
 TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/view_compiler/compile_view.d.ts(45,13): error
 TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/view_compiler/compile_view.d.ts(52,17): error
 TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/xhr.d.ts(6,23): error TS2304: Cannot find nam
e 'Promise'.
node_modules/@angular/compiler/testing/test_component_builder.d.ts(77,19): error
 TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/testing/test_component_builder.d.ts(137,43): erro
r TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/testing/xhr_mock.d.ts(10,23): error TS2304: Canno
t find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(45,88): error TS2304: Cannot
 find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(101,42): error TS2304: Canno
t find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(160,33): error TS2304: Canno
t find name 'Promise'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.
d.ts(24,15): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.
d.ts(26,16): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(106,123): error TS230
4: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(106,165): error TS230
4: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/async.d.ts(27,33): error TS2304: Cannot fi
nd name 'Promise'.
node_modules/@angular/core/src/facade/async.d.ts(28,45): error TS2304: Cannot fi
nd name 'Promise'.
node_modules/@angular/core/src/facade/collection.d.ts(1,25): error TS2304: Canno
t find name 'MapConstructor'.
node_modules/@angular/core/src/facade/collection.d.ts(2,25): error TS2304: Canno
t find name 'SetConstructor'.
node_modules/@angular/core/src/facade/collection.d.ts(4,27): error TS2304: Canno
t find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(4,39): error TS2304: Canno
t find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(7,9): error TS2304: Cannot
 find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(8,30): error TS2304: Canno
t find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(11,43): error TS2304: Cann
ot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(12,27): error TS2304: Cann
ot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(14,23): error TS2304: Cann
ot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(15,25): error TS2304: Cann
ot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(100,41): error TS2304: Can
not find name 'Set'.
node_modules/@angular/core/src/facade/collection.d.ts(101,22): error TS2304: Can
not find name 'Set'.
node_modules/@angular/core/src/facade/collection.d.ts(102,25): error TS2304: Can
not find name 'Set'.
node_modules/@angular/core/src/facade/lang.d.ts(4,17): error TS2304: Cannot find
 name 'Map'.
node_modules/@angular/core/src/facade/lang.d.ts(5,17): error TS2304: Cannot find
 name 'Set'.
node_modules/@angular/core/src/facade/lang.d.ts(71,59): error TS2304: Cannot fin
d name 'Map'.
node_modules/@angular/core/src/facade/promise.d.ts(2,14): error TS2304: Cannot f
ind name 'Promise'.
node_modules/@angular/core/src/facade/promise.d.ts(8,32): error TS2304: Cannot f
ind name 'Promise'.
node_modules/@angular/core/src/facade/promise.d.ts(9,38): error TS2304: Cannot f
ind name 'Promise'.
node_modules/@angular/core/src/facade/promise.d.ts(10,35): error TS2304: Cannot
find name 'Promise'.
node_modules/@angular/core/src/facade/promise.d.ts(10,93): error TS2304: Cannot
find name 'Promise'.
node_modules/@angular/core/src/facade/promise.d.ts(11,34): error TS2304: Cannot
find name 'Promise'.
node_modules/@angular/core/src/facade/promise.d.ts(11,50): error TS2304: Cannot
find name 'Promise'.
node_modules/@angular/core/src/facade/promise.d.ts(12,32): error TS2304: Cannot
find name 'Promise'.
node_modules/@angular/core/src/facade/promise.d.ts(12,149): error TS2304: Cannot
 find name 'Promise'.
node_modules/@angular/core/src/facade/promise.d.ts(13,43): error TS2304: Cannot
find name 'Promise'.
node_modules/@angular/core/src/linker/component_resolver.d.ts(9,58): error TS230
4: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/component_resolver.d.ts(13,49): error TS23
04: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/dynamic_component_loader.d.ts(61,148): err
or TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/dynamic_component_loader.d.ts(102,144): er
ror TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/dynamic_component_loader.d.ts(107,139): er
ror TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/dynamic_component_loader.d.ts(108,135): er
ror TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/systemjs_component_resolver.d.ts(11,53): e
rror TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/systemjs_component_resolver.d.ts(19,53): e
rror TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/testing/mock_application_ref.d.ts(12,33): error TS230
4: Cannot find name 'Promise'.
node_modules/@angular/platform-browser-dynamic/index.d.ts(72,90): error TS2304:
Cannot find name 'Promise'.
node_modules/@angular/platform-browser-dynamic/index.d.ts(73,99): error TS2304:
Cannot find name 'Promise'.
node_modules/@angular/platform-browser-dynamic/index.d.ts(74,99): error TS2304:
Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/dom/dom_adapter.d.ts(89,42): error TS
2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/dom/dom_renderer.d.ts(10,37): error T
S2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/async.d.ts(27,33): error TS230
4: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/async.d.ts(28,45): error TS230
4: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(1,25): error T
S2304: Cannot find name 'MapConstructor'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(2,25): error T
S2304: Cannot find name 'SetConstructor'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(4,27): error T
S2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(4,39): error T
S2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(7,9): error TS
2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(8,30): error T
S2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(11,43): error
TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(12,27): error
TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(14,23): error
TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(15,25): error
TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(100,41): error
 TS2304: Cannot find name 'Set'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(101,22): error
 TS2304: Cannot find name 'Set'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(102,25): error
 TS2304: Cannot find name 'Set'.
node_modules/@angular/platform-browser/src/facade/lang.d.ts(4,17): error TS2304:
 Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/lang.d.ts(5,17): error TS2304:
 Cannot find name 'Set'.
node_modules/@angular/platform-browser/src/facade/lang.d.ts(71,59): error TS2304
: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/promise.d.ts(2,14): error TS23
04: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/promise.d.ts(8,32): error TS23
04: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/promise.d.ts(9,38): error TS23
04: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/promise.d.ts(10,35): error TS2
304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/promise.d.ts(10,93): error TS2
304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/promise.d.ts(11,34): error TS2
304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/promise.d.ts(11,50): error TS2
304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/promise.d.ts(12,32): error TS2
304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/promise.d.ts(12,149): error TS
2304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/facade/promise.d.ts(13,43): error TS2
304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/web_workers/shared/client_message_bro
ker.d.ts(25,65): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/web_workers/shared/client_message_bro
ker.d.ts(33,56): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/web_workers/shared/service_message_br
oker.d.ts(33,84): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/web_workers/worker/location_providers
.d.ts(14,86): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/Observable.d.ts(10,66): error TS2304: Cannot find name 'Promis
e'.
node_modules/rxjs/Observable.d.ts(66,60): error TS2304: Cannot find name 'Promis
e'.
node_modules/rxjs/Observable.d.ts(66,70): error TS2304: Cannot find name 'Promis
e'.
app/app.component.spec.ts(32,40): error TS7006: Parameter 'fixture' implicitly h
as an 'any' type.
app/app.component.spec.ts(40,42): error TS7006: Parameter 'fixture' implicitly h
as an 'any' type.
app/app.component.spec.ts(43,43): error TS7006: Parameter 'el' implicitly has an
 'any' type.

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\lwx344455\\AppDa
ta\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.2.1
npm ERR! npm  v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart@1.0.0 start: `tsc && concurrently "tsc -w" "lite-se
rver" `
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the angular2-quickstart@1.0.0 start script 'tsc && concurrent
ly "tsc -w" "lite-server" '.
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 p
ackage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc && concurrently "tsc -w" "lite-server"
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!     C:\Users\lwx344455\Desktop\ng\hello2ng2\npm-debug.log

C:\Users\lwx344455\Desktop\ng\hello2ng2>npm install

> angular2-quickstart@1.0.0 postinstall C:\Users\lwx344455\Desktop\ng\hello2ng2
> typings install

typings ERR! message Unable to connect to "https://api.typings.org/entries/dt/ja
smine/tags/2.2.0%2B20160505161446"
typings ERR! caused by connect ETIMEDOUT 104.24.113.177:443

typings ERR! cwd C:\Users\lwx344455\Desktop\ng\hello2ng2
typings ERR! system Windows_NT 6.1.7601
typings ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\lwx344455
\\Desktop\\ng\\hello2ng2\\node_modules\\typings\\dist\\bin.js" "install"
typings ERR! node -v v6.2.1
typings ERR! typings -v 1.2.0
typings ERR! code EUNAVAILABLE

typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues>

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fseve
nts@1.0.12
npm WARN optional Skipping failed optional dependency /browser-sync/chokidar/fse
vents:
npm WARN notsup Not compatible with your operating system or architecture: fseve
nts@1.0.12
npm WARN angular2-in-memory-web-api@0.0.11 requires a peer of @angular/core@2.0.
0-rc.1 but none was installed.
npm WARN angular2-in-memory-web-api@0.0.11 requires a peer of @angular/http@2.0.
0-rc.1 but none was installed.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\lwx344455\\AppDa
ta\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.2.1
npm ERR! npm  v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart@1.0.0 postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular2-quickstart@1.0.0 postinstall script 'typings ins
tall'.
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 p
ackage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
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!     C:\Users\lwx344455\Desktop\ng\hello2ng2\npm-debug.log

//Package.json

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "postinstall": "npm run typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lite": "lite-server",
    "start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",
    "typings" : "typings"
  },
  "license": "ISC",
  "dependencies": {
    "angular2": "2.0.0-beta.6",
    "systemjs": "0.19.20",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.33.3",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.0",
    "zone.js": "0.5.14"
  },
  "devDependencies": {
    "concurrently": "^1.0.0",
    "lite-server": "^2.0.1",
    "typescript": "^1.7.5",
    "typings":"^0.6.8"
  }
}

解决方案

是时候看我的文档了angular2初入眼帘之-搭个环境

官网那个太麻烦,我这个能用

这篇关于angular.js - 为什么Angular2 Qucikstart,npm install老报错,npm start也运行不了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆