typings / typings

*DEPRECATED* The TypeScript Definition Manager
MIT License
3.38k stars 261 forks source link

'http' is found from DefinitelyTyped, but is not found on api.typings.org #225

Closed jussikinnula closed 8 years ago

jussikinnula commented 8 years ago

$ typings install --save --ambient http ? Found http typings for DefinitelyTyped. Continue? Yes typings ERR! message https://api.typings.org/versions/dt/http responded with 404, expected it to equal 200

typings ERR! cwd /Users/spot/dev/xxxx typings ERR! system Darwin 15.3.0 typings ERR! command "/usr/local/Cellar/node/5.4.0/bin/node" "/usr/local/lib/node_modules/typings/dist/bin/typings-install.js" "--save" "--ambient" "http" typings ERR! node -v v5.4.0 typings ERR! typings -v 0.6.8 typings ERR! code EINVALIDSTATUS

typings ERR! If you need help, you may report this error at: typings ERR! https://github.com/typings/typings/issues

blakeembrey commented 8 years ago

Thanks for the report, certainly a bug.

Tomino2112 commented 8 years ago

+1 on this, I cannot install jade

>typings install jade --save --ambient
? Found jade typings for DefinitelyTyped. Continue? Yes

typings ERR! message https://api.typings.org/versions/dt/jade responded with 503, expected it to equal 200

typings ERR! cwd C:\_WWW\ipushpull-api-2
typings ERR! system Windows_NT 10.0.10586
typings ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ipp1\\AppData\\Roaming\\npm\\node_modules\\typings\\dist\\bin\\typings-install.js" "jade" "--save" "--ambient"
typings ERR! node -v v4.2.6
typings ERR! typings -v 0.6.8
typings ERR! code EINVALIDSTATUS

typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues>
unional commented 8 years ago

http://angular.io/? :rose:

typings search http --ambient
Showing 10 results...

NAME                 SOURCE HOMEPAGE                                            DESCRIPTION UPDATED
angular-http-auth    dt     https://github.com/witoldsz/angular-http-auth                   2015-03-12T00:36:53.000Z
chai-http            dt     https://github.com/chaijs/chai-http                             2015-05-07T05:06:36.000Z
http                 dt     http://angular.io/                                              2015-10-12T19:20:17.000Z
http-errors          dt     https://github.com/jshttp/http-errors                           2015-12-19T02:25:03.000Z
http-status          dt     https://github.com/wdavidw/node-http-status                     2015-03-23T17:47:59.000Z
http-status-codes    dt     https://github.com/prettymuchbryce/node-http-status             2016-01-22T03:36:21.000Z
http-string-parser   dt     https://github.com/apiaryio/http-string-parser                  2014-10-15T11:16:45.000Z
js-data-http         dt     https://github.com/js-data/js-data-http                         2015-11-15T12:05:43.000Z
passport-http-bearer dt     https://github.com/jaredhanson/passport-http-bearer             2016-01-27T21:11:34.000Z
protractor-http-mock dt     https://github.com/atecarlos/protractor-http-mock               2015-12-15T09:14:58.000Z
blakeembrey commented 8 years ago

@unional Sadly the indexer for DT has some bugs. This is one, I'd appreciate a PR but I will eventually be able to fix it: https://github.com/typings/api/blob/master/src/worker/jobs/dt.ts

@Tomino2112 That looks unrelated. Most likely the API was down while you queried. Does it work for you now?

unional commented 8 years ago

I would love to help. But need to understand the context first. What should be filtered at what criteria. Should it just filter out anything that's not from https://github.com?

blakeembrey commented 8 years ago

Oh, no. It's not the filter. It's the indexer. The change I intend to do is with https://github.com/typings/api/blob/master/src/worker/jobs/dt.ts#L122. Currently it's naive (well, it'll still be naive, just a bit improved) and uses the .d.ts filename. Instead, it should check if the .d.ts filename matches the directory. If it doesn't, concat the path pieces with /. If it does, keep the name the same. Test cases:

angular/angular.d.ts #=> angular
angular/http.d.ts #=> angular/http
node/node.d.ts #=> node
node/node-0.10.d.ts #=> node
cordova/plugins/battery.d.ts #=> cordova/plugins/battery

I'm happy to make the change, just haven't had time recently.

jussikinnula commented 8 years ago

The angular/http is not the same as just http, this http I'm talking about comes via npm (e.g. npm install http). The package page doesn't say much (https://www.npmjs.com/package/http), however, the package provides a HTTP server, which ExpressJS and Socket.io can be injected.

Angular's "http" is basically an interface to use XHR, nothing much else.

And the problem is still valid, installation fails - even when the typings install --save --ambient http tells that it was found on DefinitelyTyped. HOWEVER, I cannot spot the http from https://github.com/DefinitelyTyped/DefinitelyTyped ... So it might actually be missing.

I could do http.d.ts obviously and put it to my custom.d.ts, but it's basically still a bug in typings - if package actually is not found in DefinitelyTyped, it should return an error that package was not found, isn't it? :-)

blakeembrey commented 8 years ago

Yes, I've already mentioned above that's it's a bug in the indexer. The first bug is that http is from Angular (it was there at one point, it isn't now). The source of this particular bug appears to be a race condition during indexing. It will be fixed, but I will also accept PRs.

unional commented 8 years ago

Just typing on gitter.. :) I couldn't get my hand on the API code. Tried to setup the environment, installing redis and postgres. But haven't use them before so don't know how to setup the database and admin user. :(

blakeembrey commented 8 years ago

You can create a user with http://www.postgresql.org/docs/9.1/static/app-createuser.html. I believe the default Redis install is correct. After that, you'd need to connect using psql and create the database.

Bibek-SLB commented 8 years ago

Is there somewhere we can download the latest http.d.ts from as a temporary workaround?

blakeembrey commented 8 years ago

@Bibek-SLB There is no http. What are you trying to do with it?

jussikinnula commented 8 years ago

Well, here's and example project which uses Angular 2 + TypeScript, and other modules (http, express, socket.io). The typings for http are obviously missing (and angular2/http and http node modules are indeed a "different thing"). The http basically is a http server module, that ExpressJS and Socket.io can connect to (there's a similar one also on ExpressJS built-in, but it doesn't work with Socket.io).

And the project: https://github.com/jussikinnula/angular2-socketio-chat-example

(Yes, it's another boring chat example, but WebSockets explanations are the easiest made with chats)

blakeembrey commented 8 years ago

I know they're a different thing. I'm asking what you're trying to do. If you want to contribute typings, please do. FWIW, the http you're after is a built-in node module, it has nothing to do with the NPM package.

blakeembrey commented 8 years ago

Everyone that is trying to "install" http is actually after the node ambient definition. The NPM module does nothing and looks like a common mistake for people that have never worked on node (looking at the downloads count). See https://nodejs.org/api/http.html.

Aside from that, this issue was about fixing the bug in the Typings API. For Typings requests, please go to https://github.com/typings/registry. To fix the bug, please review my previous comments.

jussikinnula commented 8 years ago

OK, this is not any bug, but merely something that just need to be solved with TypeScript & NodeJS level.

blakeembrey commented 8 years ago

I don't follow. This is a bug, just not what your issue is. The initial report is still accurate. I'm going to reopen until this is actually patched.

ndkcha commented 8 years ago

I'm having trouble installing angular, angular-material in Windows Platform. Is this bug fixed ?

blakeembrey commented 8 years ago

@ndkcha Yes. Can you please open an issue or elaborate on the issue your asking about?

ndkcha commented 8 years ago

Same error had occurred as jussikinnula mentioned on 19th Feb (1st comment of issue). It was solved. I tried it after few minutes. It worked. It might be temporary issue!

amolchandurkar commented 8 years ago

Facing similar issue when creating angular2 application with TS typings install typings ERR! message https://api.typings.org/entries/dt/node/tags/6.0.0%2B20160621231320 responded with 403, expected it to equal 200