Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Replace deprecated "request" by "got" #1217

Closed
guimard opened this issue Apr 28, 2020 · 1 comment
Closed

[BUG] Replace deprecated "request" by "got" #1217

guimard opened this issue Apr 28, 2020 · 1 comment
Labels
Bug thing that needs fixing

Comments

@guimard
Copy link

guimard commented Apr 28, 2020

What / Why

request has bee deprecated : request/request#3142

Here is a patch that removes this dependency:

--- a/lib/doctor/get-latest-nodejs-version.js
+++ b/lib/doctor/get-latest-nodejs-version.js
@@ -1,5 +1,5 @@
 var log = require('npmlog')
-var request = require('request')
+var request = require('got')
 var semver = require('semver')

 function getLatestNodejsVersion (url, cb) {
@@ -7,9 +7,8 @@
   tracker.info('getLatestNodejsVersion', 'Getting Node.js release information')
   var version = 'v0.0.0'
   url = url || 'https://nodejs.org/dist/index.json'
-  request(url, function (e, res, index) {
+  request(url).then(res => {
     tracker.finish()
-    if (e) return cb(e)
     if (res.statusCode !== 200) {
       return cb(new Error('Status not 200, ' + res.statusCode))
     }
@@ -22,6 +21,10 @@
       cb(e)
     }
   })
+  .catch(e => {
+    tracker.finish()
+    return cb(e)
+  })
 }

 module.exports = getLatestNodejsVersion
@darcyclarke darcyclarke added the Bug thing that needs fixing label Oct 30, 2020
@darcyclarke
Copy link
Contributor

npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

If your bug is reproducible on v7, please re-file this issue using our new issue template.

If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

Closing: This is an automated message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing
Projects
None yet
Development

No branches or pull requests

2 participants