WSL
WSL copied to clipboard
npm failed on building local index
$ cat /etc/apt/sources.list.d/nodesource.list
deb https://deb.nodesource.com/node_6.x trusty main
deb-src https://deb.nodesource.com/node_6.x trusty main
$ node --version
v6.2.0
$ npm --version
3.8.9
$ npm search underscore
npm WARN Building the local index for the first time, please be patient
▌ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
<--- Last few GCs --->
25074 ms: Mark-sweep 822.3 (1174.2) -> 820.7 (1180.2) MB, 472.0 / 0 ms (+ 99.2 ms in 461 steps since start of marking, biggest step 8.0 ms) [allocation failure] [GC in old space requested].
25791 ms: Mark-sweep 820.7 (1180.2) -> 795.9 (1163.1) MB, 717.8 / 0 ms [allocation failure] [GC in old space requested].
26517 ms: Mark-sweep 795.9 (1163.1) -> 795.8 (1157.1) MB, 725.4 / 0 ms [last resort gc].
27236 ms: Mark-sweep 795.8 (1157.1) -> 795.8 (1150.1) MB, 719.5 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x394804cc9e59 <JS Object>
1: fromString(aka fromString) [buffer.js:234] [pc=0x31ddf5859d4b] (this=0x394804c04189 <undefined>,string=0xd13bffecff1 <Very long string[169832941]>,encoding=0x394804cd7aa9 <String[4]: utf8>)
2: from [buffer.js:131] [pc=0x31ddf58585b6] (this=0x3aee86ae4d61 <JS Function Buffer (SharedFunctionInfo 0xe918c9f0c01)>,value=0xd13bffecff1 <Very long string[169832941]>,encodingOrOffset=0x394804...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
Aborted (core dumped)
It is a bug of npm itself. https://github.com/npm/npm/issues/12619
@Zebradil Thanks! But I don't know why bash occurs low memory problem at many scenes.
I got it working by first running npm cache clean and then retrying npm search .... Worth a try!