web-dev-qa-db-fra.com

npm start ne fonctionne pas pour Angular 2 QuickStart

Alors que je lance npm start

J'ai fait face à l'erreur suivante

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.

EDIT: Mon package.json est

{
  "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"
  }
}

Et les versions sont

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

C:\angular2-quickstart>npm -v
1.4.9
8
Partha Sarathi Ghosh

Cette erreur est due à l'absence de fichiers de définition TypeScript. Veuillez vous assurer que votre version angulaire est correcte. Ces définitions ont été retirées de l'inclusion automatique dans une version bêta récente. Vous pouvez installer ces définitions localement à l'aide de typings ou tsd.

  • Dactylographie: npm install -g typings
  • Tsd: npm install -g tsd

Ensuite, exécutez les commandes respectives pour que l'outil installe les définitions pour lesquelles il se plaint.

14
SnareChops

essayer 

npm désinstaller lite-server 

npm install -g simultanément 

npm install -g lite-server 

npm install -g TypeScript

14
Pedro Magalhães

J'ai rencontré un problème similaire parce que j'avais négligé de courir:

npm install

après que le quickstart ait été cloné. Cela a résolu le problème en installant toutes les dépendances.

1
Bahri Gungor

J'étais confronté au même problème lors de l'exécution de l'installation de npm et l'ajout de la version de typages dans la section devdependencies du fichier Package.json a résolu le problème.

1
Jitender Sharma