2016-05-24 2 views
17

utilisé:Comment installer jquery en utilisant typages

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 

Quelqu'un pourrait-il me aider.

Répondre

30

Essayez:

typings install dt~jquery --global --save 

EDIT:

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

Si vous souhaitez installer à partir DefinitelyTyped, être explicite (utilisation dt ~ --global). Par exemple: typages installation dt ~-routeur-composante angulaire --global --save

(voir le commentaire aussi Fidan Hakaj ci-dessous)

+1

Mais qu'est-ce que cela signifie exactement? – Andrey

+1

@Andrey Cela signifie DefinitelyTyped. Vu dans les dactylos Fichier README: Si vous voulez installer depuis DefinitelyTyped, soyez explicite (utilisez dt ~ --global). https://github.com/typings/typings#updating-from-0x-to-10 –

+0

comment puis-je l'utiliser maintenant? Je ne vois toujours pas les fichiers jquery * .ts –

8

Si vous utilisez typescript2.0 avec la commande:

NPM installer -g [email protected]

Vous pouvez installer jquery avec la commande:

npm installer --save @ types/jquery

+0

Alors que cela fonctionne, il souffle la variable '$' globalement ce qui est problématique pour l'utilisation avec beaucoup d'autres bibliothèques de typages. Voir ici pour une correction potentielle de namespacing '$' comme 'jquery'. https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11187 –