2016-05-24 30 views
17

usato:Come installare jQuery utilizzando tipizzazioni

typings install jquery --global 

typings ERR! message Unable to find "jquery" ("npm") in the registry. Did you want to try searching another source? Also, if you want contribute these typings, please help us: https://github.com/typings/registry 
typings ERR! caused by https://api.typings.org/entries/npm/jquery/versions/latest responded with 404, expected it to equal 200 

Qualcuno mi potrebbe aiutare.

risposta

30

Prova:

typings install dt~jquery --global --save 

EDIT:

da https://github.com/typings/typings#updating-from-0x-to-10

Se si desidera installare da DefinitelyTyped, essere esplicita (uso dt ~ --global). Per esempio: tipizzazioni installare dt ~ angolare-componente-router --global --save

(vedi il commento di Fidan anche Hakaj sotto)

+1

Ma cosa significa esattamente? – Andrey

+1

@Andrey Sta per DefinitelyTyped. Visto in battuta File README: Se vuoi installare da DefinitelyTyped, sii esplicito (usa dt ~ - globale). https://github.com/typings/typings#updating-from-0x-to-10 –

+0

come posso usarlo ora? non vedo ancora i file jquery * .ts –

8

Se si utilizza typescript2.0 con il comando:

npm installare [email protected] -g

È possibile installare jquery con il comando:

installazione npm --save @ types/jquery

+0

Mentre questo funziona, spegne la variabile '$' a livello globale che è problematica per l'uso con molte altre librerie di battitura. Vedi qui per una possibile correzione di namespace '$' come 'jquery'. https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11187 –

Problemi correlati