question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: requestsById[request.id].push is not a function

See original GitHub issue

I understand this project is no longer actively maintained. I’m just posting this bug report here in case any other users of this project might be able to suggest a fix. 😃

I installed and ran local-npm yesterday and it worked fine. Then this morning when I tried to launch it I got this error message:

~/programs/local-npm > local-npm

Welcome!
To start using local-npm, just run: 

  $ npm set registry http://127.0.0.1:5080

To switch back, you can run: 

  $ npm set registry https://registry.npmjs.org

A simple npm-like UI is available here: http://127.0.0.1:5080/_browse

PouchDB Server listening on port 16984.
Navigate to http://localhost:16984/_utils for the Fauxton UI.

/usr/lib/node_modules/local-npm/node_modules/pouchdb/lib/index.js:247
      requestsById[request.id].push(request);
                               ^

TypeError:` requestsById[request.id].push is not a function
    at /usr/lib/node_modules/local-npm/node_modules/pouchdb/lib/index.js:247:32
    at Array.forEach (native)
    at bulkGet (/usr/lib/node_modules/local-npm/node_modules/pouchdb/lib/index.js:245:12)
    at doBulkGetShim (/usr/lib/node_modules/local-npm/node_modules/pouchdb/lib/index.js:5438:9)
    at /usr/lib/node_modules/local-npm/node_modules/pouchdb/lib/index.js:5460:13
    at Request._callback (/usr/lib/node_modules/local-npm/node_modules/pouchdb/lib/index.js:5128:7)
    at Request.self.callback (/usr/lib/node_modules/local-npm/node_modules/pouchdb/node_modules/request/request.js:200:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/usr/lib/node_modules/local-npm/node_modules/pouchdb/node_modules/request/request.js:1067:10)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/local-npm/node_modules/pouchdb/node_modules/request/request.js:988:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:921:12)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)

npm: 2.15.9 node: 4.6.1 local-npm: 1.6.0

From the stack it looks like it’s an issue relating to pouchdb. The version of pouchdb I’ve got installed under local-npm, is 5.4.5

> npm -g ls pouchdb
/usr/lib
└─┬ local-npm@1.6.0
  └── pouchdb@5.4.5 

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
Shaviestcommented, Feb 2, 2017

I had the exact same problem, and found a possible solution.

I’ve changed index.js@248 from: if (request.id in requestsById)

to if ((request.id in requestsById) && (Array.isArray(requestsById[request.id])))

Look like the object requestsById sometimes didn’t hold the expected Array.

1reaction
gabrielcsapocommented, May 24, 2017

looks like this was fixed by simply updating pouchdb.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: data.push is not a function - Stack Overflow
To use the push function of an Array your var needs to be an Array. Change data{"name":"ananta","age":"15"} to following:
Read more >
TypeError: push is not a function in JavaScript | bobbyhadz
The "push is not a function" error occurs when the push() method is called on a value that is not an array. To...
Read more >
Uncaught TypeError: o.queue.push is not a function · Issue #626
I'm always getting this kind of error but I can't debug the reason. Using the debug method I can see that the requests...
Read more >
oModel.push is not a function - SAP Community
Hello All, I am currently facing one issue, Can you please help me here? I have Created one Dynamic table on click of...
Read more >
Pushing a variable on to an array results in TypeError
In my code, I am trying to add the space string to the end of the string I enter as an argument to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found