On 29 feb, 14:09, Ben Noordhuis <[email protected]> wrote:
>
> Try starting npm in the debugger and check where it hangs / busy loops:
>
>   node debug path\to\npm.js

Thanks. Did that.

Put a `debugger;` statement at the end of npm-cli.js:

72 // now actually fire up npm and run the command.
73 // this is how to use npm programmatically:
74 conf._exit = true
75 npm.load(conf, function (er) {
76   if (er) return errorHandler(er)
77   npm.commands[npm.command](npm.argv, errorHandler)
78 })
79
80 })()
81
82 debugger;

Then ran:
  node debug npm-cli.js help

Output:
< debugger listening on port 5858
connecting... ok
debug> c
break in C:\Users\uaj107\node_modules\npm\bin\npm-cli.js:82
  80 })()
  81
  82 debugger;
  83 });
debug> s
break in C:\Users\uaj107\node_modules\npm\bin\npm-cli.js:83
  81
  82 debugger;
  83 });
debug> s
break in module.js:442
 440   var args = [self.exports, require, self, filename, dirname];
 441   return compiledWrapper.apply(self.exports, args);
 442 };
 443
 444
debug> s
break in module.js:460
 458   var content = NativeModule.require('fs').readFileSync(filename,
'utf8');
 459   module._compile(stripBOM(content), filename);
 460 };
 461
 462
debug> s
break in module.js:349
 347   if (!Module._extensions[extension]) extension = '.js';
 348   Module._extensions[extension](this, filename);
 349   this.loaded = true;
 350 };
 351
debug> s
break in module.js:350
 348   Module._extensions[extension](this, filename);
 349   this.loaded = true;
 350 };
 351
 352
debug> s
break in module.js:314
 312   }
 313
 314   return module.exports;
 315 };
 316
debug> s
break in module.js:315
 313
 314   return module.exports;
 315 };
 316
 317 Module._resolveFilename = function(request, parent) {
debug> s
break in module.js:480
 478   // Load the main module--the command line argument.
 479   Module._load(process.argv[1], null, true);
 480 };
 481
 482 Module._initPaths = function() {
debug> s
break in node.js:192
 190
 191       try {
 192         for (var i = 0; i < l; i++) q[i]();
 193       }
 194       catch (e) {
debug> s
break in node.js:203
 201         throw e; // process.nextTick error, or 'error' event on
first tick
 202       }
 203     };
 204
 205     process.nextTick = function(callback) {
debug> s
debug>

It blows up right after the last s, i.e. after executing line 203 of
node.js

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to