症状
npmを実行しようとするとメモリ不足で落ちる.
nodenvで最新versionのnode及び,npmをインストールしてもだめでした.
bash
1$ npm 2Error: ENOMEM: not enough memory, scandir '/home/maxmellon' 3 at Error (native) 4
環境
freeコマンドでメモリを確認してみます
bash
1$ free -h 2 total used free shared buff/cache available 3Mem: 31G 1.3G 27G 24M 2.9G 29G 4Swap: 31G 0B 31G
27G 空いているので,メモリ不足は考えにくいと思っています.
bash
1$ node 2> console.log('hoge') 3hoge 4undefined
console.log は問題なく動きました.
試しに,npm/npm を clone してきて,makeしてみました
bash
1$ ./configure 2 3$ make 4scripts/doc-build.sh doc/cli/npm-dist-tag.md man/man1/npm-dist-tag.1 5make[1]: ディレクトリ '/home/maxmellon/work/ghq/github.com/npm/npm' に入ります 6node bin/npm-cli.js install marked-man --no-global --no-timing --no-save 7Error: ENOMEM: not enough memory, scandir '/home/maxmellon/work/ghq/github.com/npm/npm' 8 at Error (native) 9TypeError: Cannot read property 'get' of undefined 10 at errorHandler (/home/maxmellon/work/ghq/github.com/npm/npm/lib/utils/error-handler.js:213:17) 11 at /home/maxmellon/work/ghq/github.com/npm/npm/bin/npm-cli.js:83:20 12 at cb (/home/maxmellon/work/ghq/github.com/npm/npm/lib/npm.js:215:22) 13 at /home/maxmellon/work/ghq/github.com/npm/npm/lib/npm.js:253:24 14 at /home/maxmellon/work/ghq/github.com/npm/npm/lib/config/core.js:81:7 15 at Array.forEach (native) 16 at /home/maxmellon/work/ghq/github.com/npm/npm/lib/config/core.js:80:13 17 at f (/home/maxmellon/work/ghq/github.com/npm/npm/node_modules/once/once.js:25:25) 18 at /home/maxmellon/work/ghq/github.com/npm/npm/lib/config/core.js:110:20 19 at /home/maxmellon/work/ghq/github.com/npm/npm/lib/config/load-prefix.js:48:7 20/home/maxmellon/work/ghq/github.com/npm/npm/lib/utils/error-handler.js:213 21 if (npm.config.get('json')) { 22 ^ 23 24TypeError: Cannot read property 'get' of undefined 25 at process.errorHandler (/home/maxmellon/work/ghq/github.com/npm/npm/lib/utils/error-handler.js:213:17) 26 at emitOne (events.js:77:13) 27 at process.emit (events.js:169:7) 28 at process._fatalException (node.js:223:26) 29Makefile:155: ターゲット 'node_modules/.bin/marked-man' のレシピで失敗しました 30make[1]: *** [node_modules/.bin/marked-man] エラー 7 31make[1]: ディレクトリ '/home/maxmellon/work/ghq/github.com/npm/npm' から出ます 32Makefile:97: ターゲット 'man/man1/npm-dist-tag.1' のレシピで失敗しました 33make: *** [man/man1/npm-dist-tag.1] エラー 2
npm@5系列は,node@4以降であれば使えるはずなんですが,メモリ不足で make に失敗しました.
その他
ruby 及び,pythonなどその他の言語は問題なく動いています.
npm だけ Memory不足で落ちていて検討もつかず困っています.
下記の環境で発生しています.
$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS" $ uname -a Linux Zonta 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux $ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 58 model name : Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz stepping : 9 microcode : 0x1c cpu MHz : 1600.292 cache size : 8192 KB physical id : 0 siblings : 8 core id : 0 cpu cores : 4 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr ss e sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good noplxtopology nonstop_tsc aperfmp erf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadli ne_timer aes xsave avx f16c rdrand lahf_lm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dther m ida arat pln pts bugs : bogomips : 6999.93 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: $ cat /proc/meminfo MemTotal: 32899036 kB MemFree: 28498064 kB MemAvailable: 31350084 kB Buffers: 273580 kB Cached: 2403940 kB SwapCached: 0 kB Active: 2859408 kB Inactive: 1049008 kB Active(anon): 1232260 kB Inactive(anon): 23948 kB Active(file): 1627148 kB Inactive(file): 1025060 kB Unevictable: 32 kB Mlocked: 32 kB SwapTotal: 33503228 kB SwapFree: 33503228 kB Dirty: 40 kB Writeback: 0 kB AnonPages: 1231048 kB Mapped: 264760 kB Shmem: 25316 kB Slab: 331620 kB SReclaimable: 285648 kB SUnreclaim: 45972 kB KernelStack: 8896 kB PageTables: 33160 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 49952744 kB Committed_AS: 4388188 kB VmallocTotal: 34359738367 kB VmallocUsed: 0 kB VmallocChunk: 0 kB HardwareCorrupted: 0 kB AnonHugePages: 456704 kB CmaTotal: 0 kB CmaFree: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 103340 kB DirectMap2M: 33402880 kB
追記
memoryテストもしてみました
$ sudo memtester 1024 5 memtester version 4.3.0 (64-bit) Copyright (C) 2001-2012 Charles Cazabon. Licensed under the GNU General Public License version 2 (only). pagesize is 4096 pagesizemask is 0xfffffffffffff000 want 1024MB (1073741824 bytes) got 699MB (733724672 bytes), trying mlock ...locked. Loop 1/5: Stuck Address : ok Random Value : ok Compare XOR : ok Compare SUB : ok Compare MUL : ok Compare DIV : ok Compare OR : ok Compare AND : ok Sequential Increment: ok Solid Bits : ok Block Sequential : ok Checkerboard : ok Bit Spread : ok Bit Flip : ok Walking Ones : ok Walking Zeroes : ok 8-bit Writes : ok 16-bit Writes : ok Loop 2/5: Stuck Address : ok Random Value : ok Compare XOR : ok Compare SUB : ok Compare MUL : ok Compare DIV : ok Compare OR : ok Compare AND : ok Sequential Increment: ok Solid Bits : ok Block Sequential : ok Checkerboard : ok Bit Spread : ok Bit Flip : ok Walking Ones : ok Walking Zeroes : ok 8-bit Writes : ok 16-bit Writes : ok Loop 3/5: Stuck Address : ok Random Value : ok Compare XOR : ok Compare SUB : ok Compare MUL : ok Compare DIV : ok Compare OR : ok Compare AND : ok Sequential Increment: ok Solid Bits : ok Block Sequential : ok Checkerboard : ok Bit Spread : ok Bit Flip : ok Walking Ones : ok Walking Zeroes : ok 8-bit Writes : ok 16-bit Writes : ok Loop 4/5: Stuck Address : ok Random Value : ok Compare XOR : ok Compare SUB : ok Compare MUL : ok Compare DIV : ok Compare OR : ok Compare AND : ok Sequential Increment: ok Solid Bits : ok Block Sequential : ok Checkerboard : ok Bit Spread : ok Bit Flip : ok Walking Ones : ok Walking Zeroes : ok 8-bit Writes : ok 16-bit Writes : ok Loop 5/5: Stuck Address : ok Random Value : ok Compare XOR : ok Compare SUB : ok Compare MUL : ok Compare DIV : ok Compare OR : ok Compare AND : ok Sequential Increment: ok Solid Bits : ok Block Sequential : ok Checkerboard : ok Bit Spread : ok Bit Flip : ok Walking Ones : ok Walking Zeroes : ok 8-bit Writes : ok 16-bit Writes : ok Done.

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。