npm start不适用于Angular 2 QuickStart

时间:2016-02-17 05:59:25

标签: angular lite-server

我运行npm start

我遇到了以下错误

C:\angular2-quickstart>npm start

> angular2-quickstart@1.0.0 start C:\angular2-quickstart
> concurrent "npm run tsc:w" "npm run lite"

[0]
[0] > angular2-quickstart@1.0.0 tsc:w C:\angular2-quickstart
[0] > tsc -w
[0]
[1]
[1] > angular2-quickstart@1.0.0 lite C:\angular2-quickstart
[1] > lite-server
[1]
[1] 'lite-server' is not recognized as an internal or external command,
[1] operable program or batch file.
[1]
[1] npm
[1]
[1] ERR!
[1]  angular2-quickstart@1.0.0 lite: `lite-server`
[1] npm
[1]
[1] ERR!
[1]  Exit status 1
[1] npm
[1]
[1] ERR!
[1]
[1] npm
[1] ERR!
[1]  Failed at the angular2-quickstart@1.0.0 lite script.
[1] npm
[1]
[1] ERR!
[1]  This is most likely a problem with the angular2-quickstart package,
[1] npm ERR! not with npm itself.
[1] npm ERR! Tell the author that this fails on your system:
[1] npm
[1]
[1] ERR!
[1]      lite-server
[1] npm
[1]
[1] ERR!
[1]  You can get their info via:
[1] npm
[1]  ERR!     npm owner ls angular2-quickstart
[1] npm
[1] ERR! There is likely additional logging output above.
[1] npm ERR! System Windows_NT 6.1.7601
[1] npm ERR! command "C:\\Software\\npm-1.4.9\\node.exe" "C:\\Software\\npm-1.4.
9\\node_modules\\npm\\bin\\npm-cli.js" "run" "lite"
[1] npm ERR! cwd C:\angular2-quickstart
[1] npm ERR! node -v v5.0.0
[1] npm ERR! npm -v 1.4.9
[1] npm ERR! code ELIFECYCLE
[1] npm ERR!
[1] npm ERR! Additional logging details can be found in:
[1] npm ERR!     C:\angular2-quickstart\npm-debug.log
[1] npm ERR! not ok code 0
[1] npm run lite exited with code 1
[0] node_modules/angular2/src/core/change_detection/parser/locals.d.ts(3,14): er    ror TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/change_detection/parser/locals.d.ts(4,42): er    ror TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/debug/debug_node.d.ts(14,13): error TS2304: C
annot find name 'Map'.
[0] node_modules/angular2/src/core/debug/debug_node.d.ts(24,17): error TS2304: C
annot find name 'Map'.
[0] node_modules/angular2/src/core/debug/debug_node.d.ts(25,17): error TS2304: C
annot find name 'Map'.
[0] node_modules/angular2/src/core/di/provider.d.ts(436,103): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/di/provider.d.ts(436,135): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/render/api.d.ts(13,13): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/render/api.d.ts(14,84): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(1,25): error TS2304: Cannot find name 'MapConstructor'.
[0] node_modules/angular2/src/facade/collection.d.ts(2,25): error TS2304: Cannot find name 'SetConstructor'.
[0] node_modules/angular2/src/facade/collection.d.ts(4,27): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(4,39): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(7,9): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(8,30): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(11,43): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(12,27): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(14,23): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(15,25): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(95,41): error TS2304: Cannot find name 'Set'.
[0] node_modules/angular2/src/facade/collection.d.ts(96,22): error TS2304: Canno
t find name 'Set'.
[0] node_modules/angular2/src/facade/collection.d.ts(97,25): error TS2304: Canno
t find name 'Set'.
[0] node_modules/angular2/src/facade/lang.d.ts(13,17): error TS2304: Cannot find
 name 'Map'.
[0] node_modules/angular2/src/facade/lang.d.ts(14,17): error TS2304: Cannot find
 name 'Set'.
[0] node_modules/angular2/src/facade/lang.d.ts(78,59): error TS2304: Cannot find
 name 'Map'.
[0] node_modules/angular2/src/facade/promise.d.ts(1,10): error TS2304: Cannot fi
nd name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(3,14): error TS2304: Cannot fi
nd name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(8,32): error TS2304: Cannot fi
nd name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(9,38): error TS2304: Cannot fi
nd name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(10,35): error TS2304: Cannot f
ind name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(10,93): error TS2304: Cannot f
ind name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(11,34): error TS2304: Cannot f
ind name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(12,32): error TS2304: Cannot f
ind name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(12,149): error TS2304: Cannot
find name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(13,43): error TS2304: Cannot f
ind name 'Promise'.
[0] node_modules/angular2/src/platform/browser/browser_adapter.d.ts(75,33): erro
r TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/platform/dom/dom_adapter.d.ts(85,42): error TS2304
: Cannot find name 'Map'.
[0] node_modules/rxjs/CoreOperators.d.ts(22,67): error TS2304: Cannot find name
'Promise'.
[0] node_modules/rxjs/CoreOperators.d.ts(72,67): error TS2304: Cannot find name
'Promise'.
[0] node_modules/rxjs/CoreOperators.d.ts(77,31): error TS2304: Cannot find name
'PromiseConstructor'.
[0] node_modules/rxjs/CoreOperators.d.ts(77,54): error TS2304: Cannot find name
'Promise'.
[0] node_modules/rxjs/Observable.d.ts(65,67): error TS2304: Cannot find name 'Pr
omiseConstructor'.
[0] node_modules/rxjs/Observable.d.ts(65,88): error TS2304: Cannot find name 'Pr
omise'.
[0] node_modules/rxjs/Observable.d.ts(72,84): error TS2304: Cannot find name 'Pr
omise'.
[0] node_modules/rxjs/Observable.d.ts(77,38): error TS2304: Cannot find name 'Pr
omise'.
[0] node_modules/rxjs/Observable.d.ts(100,66): error TS2304: Cannot find name 'P
romise'.
[0] node_modules/rxjs/Observable.d.ts(154,66): error TS2304: Cannot find name 'P
romise'.
[0] node_modules/rxjs/Observable.d.ts(159,31): error TS2304: Cannot find name 'P
romiseConstructor'.
[0] node_modules/rxjs/Observable.d.ts(159,54): error TS2304: Cannot find name 'P
romise'.
[0] 11:22:53 AM - Compilation complete. Watching for file changes.

修改 我的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"
  }
}

版本

C:\angular2-quickstart>node -v
v5.0.0

C:\angular2-quickstart>npm -v
1.4.9

4 个答案:

答案 0 :(得分:15)

尝试

npm uninstall lite-server

npm install -g concurrently

npm install -g lite-server

npm install -g typescript

答案 1 :(得分:14)

此错误是由缺少TypeScript定义文件引起的。请确保您的角度版本正确。这些定义已从最近的测试版中自动包含在内。您可以使用typingstsd在本地安装这些定义。

  • 打字:npm install -g typings
  • Tsd:npm install -g tsd

然后运行该工具的相应命令以安装它抱怨的定义。

答案 2 :(得分:1)

我在运行npm install时遇到了同样的问题,在Package.json文件的devdependencies部分添加了typeings版本解决了这个问题。

答案 3 :(得分:1)

我遇到了类似的问题,因为我忽略了运行:

npm install
克隆快速启动后的

。这通过安装所有依赖项解决了这个问题。