Search code examples
javascriptnode.jsbowerbower-install

bower install > TypeError: msecs must be a number


I recently upgraded to node.js v0.12.7 and I have an issue with bower install when I want to install dependencies into a project folder:

$ bower install 
timers.js:165
    throw new TypeError('msecs must be a number');
          ^
TypeError: msecs must be a number
    at Object.exports.enroll (timers.js:165:11)
    at Socket.setTimeout (net.js:337:12)
    at ClientRequest.<anonymous> (_http_client.js:565:10)
    at ClientRequest.g (events.js:199:16)
    at ClientRequest.emit (events.js:129:20)
    at tickOnSocket (_http_client.js:493:7)
    at _http_client.js:504:7
    at process._tickCallback (node.js:355:11)

$ node --version
v0.12.7 

I saw that there is some related issues with node.js v0.12 and this error message that says that it requires options with timeout argument defined.

So I tried to add a timeout in my folder parent tree in each .bowerrc

{
  "registry": "http://bower.mycompany.com",
  "timeout": "15000",
  "directory": "public/lib"
}

But it didn't worked as expected. Same error always thrown.


Solution

  • Thanks to robertklep's comment, I edited .bowerrc to match a defined and number typed!" timeout field.

    So I clarify the solution for those who get the same error after upgrading to node.js > v0.10 :

    If you have a .bowerrc file in your project folder or parent folder tree, you must fill it with a number typed timeout (for example 15000) as like this :

    {
      "timeout": 15000
    }