2016-02-17 9 views
7

Mentre corro npm startinizio npm non funziona per Angular 2 QuickStart

ho affrontato il seguente errore

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: mio 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" 
    } 
} 

E le versioni sono

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

C:\angular2-quickstart>npm -v 
1.4.9 

risposta

14

Questo errore è causato da file di definizione TypeScript mancanti. Assicurati che la tua versione angolare sia corretta. Queste definizioni non sono state incluse automaticamente in una recente versione beta. È possibile installare queste definizioni localmente utilizzando typings o tsd.

  • Tipizzazioni: npm install -g typings
  • tsd: npm install -g tsd

quindi eseguire i rispettivi comandi per l'utensile per installare le definizioni che si lamentano.

+0

Ho aggiornato la domanda con le versioni pagkage.json e npm che cosa sto usando. Ecco il link https://angular.io/docs/ts/latest/quickstart.html –

+0

Ho provato entrambe le opzioni ma non ha funzionato. –

+0

cambia postinstall in "postinstall": "typings install" – MTo

12

provare

NPM lite-server di disinstallazione

npm installare -g concomitanza

npm installare -g lite server

npm installare dattiloscritto -g

+1

grazie !! Ha funzionato finalmente per me :) –

+0

ha funzionato anche per me –

1

stavo affrontando lo stesso problema durante l'esecuzione dell'installazione di npm e l'aggiunta della versione dei tipi nella sezione devdependencies del file Package.json ha risolto il problema.

0

mi sono imbattuto in un problema simile perché avevo trascurato di eseguire

npm installare

dopo l'avvio rapido era stato clonato. Questo ha risolto il problema per me.