我将npm运行到FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
时出现问题。
因为我在我的新PC上安装了node.js& npm,所以它没有用。
唯一有效的npm命令是npm -v
其他命令会遇到内存不足。
~/.npm
& ~/npm_cache
(两者都不存在)node --max_old_space_size=8000 /usr/bin/npm [command]
运行npm,但会产生不同的异常(异常" Z")(https://stackoverflow.com/a/40939496)$ npm help -ddd
<--- Last few GCs --->
[17172:000001E0EEED86A0] 423428 ms: Mark-sweep 1485.5 (1522.0) -> 1485.5 (1522.0) MB, 2817.0 / 0.0 ms allocation failure GC in old space requested
[17172:000001E0EEED86A0] 426164 ms: Mark-sweep 1485.5 (1522.0) -> 1485.5 (1516.0) MB, 2735.9 / 0.0 ms last resort gc
[17172:000001E0EEED86A0] 429133 ms: Mark-sweep 1485.5 (1516.0) -> 1485.5 (1516.0) MB, 2969.9 / 0.0 ms last resort gc
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 000003092D4C0D59 <JS Object>
2: listener [C:\NodeJS\v5\node_modules\npm\node_modules\npmlog\node_modules\gauge\node_modules\signal-exit\index.js:88] [pc=0000031922938DD5](this=000002CCA2196281 <a process with map 000001E744610B71>)
3: emitNone(aka emitNone) [events.js:86] [pc=0000031922938B31](this=000003092D404311 <undefined>,handler=0000031F86B79379 <JS Function listener (SharedFunctionInfo 0000031F86B79029)>,i...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
JS堆栈跟踪似乎不时有所不同,例如像这样:
==== JS stack trace =========================================
Security context: 0000031DFB2C0D59 <JS Object>
2: emitNone(aka emitNone) [events.js:86] [pc=000002993916DA71](this=0000031DFB204311 <undefined>,handler=00000360FFC77F41 <JS Function listener (SharedFunctionInfo 00000360FFC77BF1)>,isFn=0000031DFB2043B1 <true>,self=000002EEFFA95499 <a process with map 000000CA9BF10B71>)
3: emit [events.js:185] [pc=000002993916D5CA](this=000002EEFFA95499 <a process with map 000000CA9BF10B71>,type=000...
例外&#34; Z&#34;从运行node --max_old_space_size=4000 /c/NodeJS/npm help
C:\NodeJS\v5\npm:4
case `uname` in
^^^^
SyntaxError: Unexpected token case
at Object.exports.runInThisContext (vm.js:78:16)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
我认为,安装不是问题,因为我从配对中获得了一个工作的node.js文件夹。但是直到现在这台电脑上我都没有配置(也许这是错误的?)
答案 0 :(得分:0)
我找到了这个错误的解决方案 http://www.fatalerrors.org/a/fatal-error-markcompactcollector-semi-space-copy.html。我在这个配置中有一个无效的路径(分区)。删除条目后,我可以再次使用npm。