-
Notifications
You must be signed in to change notification settings - Fork 3k
npm search crashes with GC error when building local cache #12619
Comments
Same here on OSX 10.11, Node 6.1.0 and npm 3.8.9, running npm search tsun. Trying again, search immediately shows this error, then attempts to build the local index:
Then, after several more tries, search does produce some output, then shows a different error:
Here's the referenced log:
|
Yeah, look like the same issue. |
I am getting the same issue via node 6.1.0 and npm 3.8.9
|
Just came here after seeing the same issue. Was hoping for a workaround or so. Mac OSX 10.11.4 |
@Meligy the workaround seems to be "run it again until it works". It's not a great solution though. |
@iankronquist thanks. I got another error with no stack trace when I tried again with NPM 3.9.0, then it worked the next time. Not sure because this is the workaround, or because NPM 3.9.0 fixes it. |
For me neither 3.9.0 nor 3.9.2 have solved the issue. The funny is, I disabled npm progress but I see this pesky progress bar now again... npm inc. tries to push it hard, as it seems.
|
Same here. On my Mac the npm search process eats slowly up to around 200MB memory, then quickly jumps to over 1.3GB and dies. |
This is a known issue, and has to do with the underlying implementation of search in the CLI being pretty terrible for anything more than a couple thousand packages. Replacing the search code with something that queries an online endpoint is something the various engineering teams at npm would like to do, but it hasn't been addressed until now because it's never quite risen to the top of the priority list, and because it's something that to fix properly requires coördinated effort between multiple teams at npm, Inc. The out of memory errors are at least partially addressed by #10615, which has stalled pending some work to make it testable (and getting the relevant changes into |
I got it working by first running |
The 2nd try returns a result even without cleaning the cache. |
[email protected]
worked on 3rd try but still errors
npm-debug.log |
|
Same thing happening here $ npm search flowchart
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/6.2.0/bin/node" "/usr/local/bin/npm" "search" "flowchart"
npm ERR! node v6.2.0
npm ERR! npm v3.9.5
npm ERR! Cannot read property '_updated' of undefined
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm WARN Building the local index for the first time, please be patient
<--- Last few GCs --->
89305 ms: Mark-sweep 840.8 (1212.3) -> 839.5 (1219.3) MB, 669.0 / 0 ms (+ 144.2 ms in 880 steps since start of marking, biggest step 14.2 ms) [allocation failure] [GC in old space requested].
90396 ms: Mark-sweep 839.5 (1219.3) -> 814.6 (1200.1) MB, 1091.2 / 0 ms [allocation failure] [GC in old space requested].
91437 ms: Mark-sweep 814.6 (1200.1) -> 814.5 (1194.1) MB, 1040.8 / 0 ms [last resort gc].
92467 ms: Mark-sweep 814.5 (1194.1) -> 814.5 (1187.1) MB, 1030.2 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x1b8201dc9e59 <JS Object>
1: fromString(aka fromString) [buffer.js:234] [pc=0x12eef20ca92b] (this=0x1b8201d04189 <undefined>,string=0x2d1354ecd279 <Very long string[174148194]>,encoding=0x1b8201dd7aa9 <String[4]: utf8>)
2: from [buffer.js:131] [pc=0x12eef205add6] (this=0x91843f5b99 <JS Function Buffer (SharedFunctionInfo 0x3625945f29b1)>,value=0x2d1354ecd279 Abort trap: 6 $ node -v
v6.2.0
$ npm -v
3.9.5
and then it gave me the proper output
The thing is: I've to clean the cache every time I want to perform a search, it takes forever and it crashes randomly. My machine is a macbook air with 8GB RAM, Core i7, SSD and OS X El Capitan. It's not that bad at all. |
@andreportela the best bet for the time being is to create an alias for
Running the above search complete, but uses 2.2GB of memory 😐 |
@antjkennedy thanks!
$ node --max-old-space-size=4000 /usr/local/bin/npm search flowchart
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/6.2.0/bin/node" "/usr/local/bin/npm" "search" "flowchart"
npm ERR! node v6.2.0
npm ERR! npm v3.9.5
npm ERR! Cannot read property '_updated' of undefined
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm WARN Building the local index for the first time, please be patient
NAME DESCRIPTION AUTHOR DATE
angularjs-flowchart AngularJS-FlowChart =================== =gang.li 2016-03-31
decisiontreejs A utility module providing asynchronous control flow… =petecleary 2013-02-26
dgeni-diagrams-package Mermaid diagrams for Dgeni documentation generator =wingedfox 2016-02-18
diagrams Generate Flowcharts, Network Sequence, Dot, and Railroad… =francoislaberge 2016-01-03
flowchart a quick utility for walking through a flowchart =pmcelhaney 2015-04-17
flowchart-render the render part for http://elemefe.github.io/flowchart =misaka 2016-05-12
flowchart.js [![JS.ORG](https://img.shields.io/badge/js.org-flowchart-ff… =adrai 2016-05-26
flowgraph interactive graph editor in the browser =finnpauls 2015-07-01
flowtex easy flowchart latex using tikz =pierre-luc 2016-03-27
flowyjs Create flowcharts algorithmically =t3pleni9 2016-03-06
gitbook-plugin-flowchart flowchart.js plugin for GitBook =midnightsuyama 2016-02-25
gitbook-plugin-flowchart-full Flowchart plugin for gitbook =yinyongcom666 2016-06-04
gitbook-plugin-new-flowchart flowchart.js plugin for gitbook =nsdont 2016-04-13
gojs Interactive diagrams, charts, and graphs, such as trees,… =gojs =simonsarris 2016-05-23
jointjs JavaScript diagramming library =chill1… 2016-05-31
jquery.flowchart JQuery UI plugin that allows you to draw a flow chart. =sdrdis 2016-05-14
mermaid Markdownish syntax for generating flowcharts, sequence… =knsv 2016-05-29
pcnchart Create an SVG string to display Process Chain Network data =tgroshon 2014-12-04
react-flowchart An interactive flowchart using React =wunderlink 2015-08-18
react-mermaid A react component to display mermaid diagrams and… =jasonbellamy 2015-08-28
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/6.2.0/bin/node" "/usr/local/bin/npm" "search" "flowchart"
npm ERR! node v6.2.0
npm ERR! npm v3.9.5
npm ERR! Callback called more than once.
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/myuser/myproject/npm-debug.log Subsequent calls using same command worked well :) I'm just wondering the size of the cache it built and where can I find this cache? |
@andreportela - run |
As the registry continues to grow beyond 300,000 packages, this problem (which is really more a design flaw than a bug) is only going to grow more severe. The CLI team may land a variant of #10615 if we can figure out how to make it work with Node 6, or we may just (temporarily) remove CLI search altogether. Until the team has the time to address this more comprehensively, my recommendation is to use web search, either via https://www.npm.com or via one of the many alternatives, such as https://npms.io or http://node-modules.com. |
It seems it has to be http://node-modules.com and not https. Also check out the cli tool for A search for |
'opened this issue on May 8' makes me want to apply for a job at npm :3 . Good luck with all the work npm team! You can do it! |
The same problem:
|
changed my npm wrapper as the following npm gist
|
Hey guys. Could you please tell me (us?) in which version this - like veeeeery - annoying bug will be fixed? To be honest, it's one of the biggest usecases to search for packages. I'm sorry, but I'm frustrated by this issue for the 99th time :-( |
@alextes Well it is merged 😉 |
|
It just took us seven months to build a slow search feature which gladly crashes only at the end of the search procedure. |
(More like 6 years) [sexist commentary moderated] Yeah my comment was actually against sexism ... but one can never please you guys. |
Same here.
npm version: 3.10.9 Installed on macOS 10.12.1 using homebrew. |
@felipead As mentioned above, this was fixed in |
Thanks! Will try to install this version then. |
upgrade to
|
The issue is fixed with npm@4. Thanks a lot for the hard work. I also liked the small little smiley on the CLI while its searching. Good job. |
|
|
Please update to the latest version of npm, where search is now fixed.
|
@Charlotteis thanks for that. That's the fix I needed. When I downloaded the latest stable release of Node, the NPM version that comes bundled caused the JavaScript heap issue everyone in this thread is complaining about. This happened on two different Windows 10 machines. After updating NPM as advised by @Charlotteis - the issue is fixed. But why is a broken NPM being distributed within the main stable download of Node (v6.9.4 lts)? This seems a bit stupid. |
@ddmee npm@4 is being brought into node@6. It's just not that simple because this was a (necessarily) breaking npm change and node LTS policy is to not take major dependency bumps like that, so there needed to be some discussion. "Don't ship broken things" definitely prioritizes things that affect the core functionality for npm: installation. Secondary things like CLI search are understandably lower priority if it involves breaking changes. |
Since we keep getting questions about this long after the fixed version has been released, I'm going to lock this issue with the following message for those who haven't read the thread: If you experience this issue with npm search, upgrade to at least |
OS X 10.11, npm 3.8.6, node 6.0.0 all installed using homebrew. I managed to get this to happen twice in a row before succeeding.
The text was updated successfully, but these errors were encountered: