gruntjs / gruntjs.com

Grunt website
https://gruntjs.com
Other
155 stars 84 forks source link

`grunt downloadPlugins` fails #171

Closed XhmikosR closed 8 years ago

XhmikosR commented 8 years ago

/CC @vladikoff

XhmikosR commented 8 years ago

After debugging this, the cause is I'm getting ETIMEDOUT for some plugins. So, we need to handle this case and retry maybe.

  grunt-plugins.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/grunt-plugins.js b/grunt-plugins.js
index c622a4c..7190196 100644
--- a/grunt-plugins.js
+++ b/grunt-plugins.js
@@ -108,11 +108,13 @@ function condensePlugin(plugin) {
 function getPlugin(item, callback) {
   var name = item.key[1];
   var url = 'https://skimdb.npmjs.com/registry/' + name;
-  request({url: url, json: true}, function handlePlugin(error, response, body) {
+  request({url: url, json: true, timeout: 30000}, function handlePlugin(error, response, body) {
+    //console.log('>>> name: ' + name + ', error: ' + error);
+    //console.log('>>> name: ' + name + ', error: ' + error + ', response.statusCode: ' + response.statusCode);
     if (!error && response.statusCode === 200) {
       callback(null, condensePlugin(body));
     } else {
-      console.log('Failed to get data for:', name);
+      console.log('Failed to get data for:', name + ' with error.code: ' + error.code);
       callback(null, null);
     }
   });

And the output https://gist.github.com/XhmikosR/0f8ccce52b6bddd952b075468039f576

XhmikosR commented 8 years ago

Why close this? It's still a valid issue.

vladikoff commented 8 years ago

@XhmikosR hm I thought the lists generates fine ? looking at http://gruntjs.com/plugins

XhmikosR commented 8 years ago

Well, it does generate but many plugins should be missing due to this error.