web-dev-qa-db-ja.com

npmstartがAngular 2QuickStartに対して機能していません

私が走っている間npm start

私は次のエラーに直面しました

C:\angular2-quickstart>npm start

> [email protected] start C:\angular2-quickstart
> concurrent "npm run tsc:w" "npm run lite"

[0]
[0] > [email protected] tsc:w C:\angular2-quickstart
[0] > tsc -w
[0]
[1]
[1] > [email protected] 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]  [email protected] 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 [email protected] 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

このエラーは、TypeScript定義ファイルが欠落していることが原因で発生します。 angularバージョンが正しいことを確認してください。これらの定義は、最近のベータリリースに自動的に含まれるように削除されました。これらの定義は、typingsまたはtsd

  • 入力:npm install -g typings
  • Tsd:npm install -g tsd

次に、ツールのそれぞれのコマンドを実行して、不平を言っている定義をインストールします。

14
SnareChops

試してみてください

npmアンインストールlite-server

npm install-gを同時に

npm install -g lite-server

npm install -g TypeScript

15

実行を怠っていたため、同様の問題が発生しました。

npm install

クイックスタートのクローンが作成された後。これにより、すべての依存関係をインストールすることで問題が解決しました。

1
Bahri Gungor

Npm installを実行し、Package.jsonファイルのdevdependenciesセクションにタイピングバージョンを追加しているときに同じ問題が発生し、問題が解決しました。

1
Jitender Sharma