Fixing Typings error: Unable to find “react” (“npm”) in the registry

When I first tried to use typings, I got a lot of errors like this:

typings ERR! message Unable to find "react" ("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/react/versions/latest responded with 404, expected it to equal 200

typings ERR! cwd /Users/gary/youtube
typings ERR! system Darwin 14.0.0
typings ERR! command "/usr/local/bin/node" "/usr/local/bin/typings" "install" "react" "--save"
typings ERR! node -v v6.0.0
typings ERR! typings -v 0.8.1

typings ERR! If you need help, you may report this error at:
typings ERR!   

This means that while the type bindings you’re trying to download may not exist, they do not exist in the default source location, which apparently is npm.

To fix this, you need to re-run the search command, like so, to find the correct location:

typings search --name react
Viewing 1 of 1

NAME  SOURCE HOMEPAGE                         DESCRIPTION UPDATED                 
react dt     http://facebook.github.io/react/             2016-04-23T06:59:14.000Z

In this case the source is “dt”, so you need to run this command (note the apostrophes – needed for bash):

typings install 'dt!react' --save

Which will give you this output, showing that it works:

react
└── (No dependencies)

5 Replies to “Fixing Typings error: Unable to find “react” (“npm”) in the registry”

  1. For the last part, I had to use:

    dt~react instead of ‘dt!react’

    This is on windows from a cmd prompt (not sure if that’s relevant.)

  2. Also in the event of the error “Attempted to compile “react” as an external module, but it looks like a global module.” you would have to append the –global parameter. It obviously depends on how you installed typings in the first place. So the command would look like:

    typings install dt~react –save –global

  3. Thank you, Gary and Dave, I was beating my head against the wall trying to figure out what finicky command Typings required to install the definitions for React. You’d think with the state of most definitions still being ambient/global there would be better documentation for installing from DT on the official Typings Github!

Leave a Reply

Your email address will not be published. Required fields are marked *