JavaScript heap out of memory

Workaround to fix heap out of memory when running node binaries. It's a common issue when using TypeScript 2.1+ and webpack.
This tool will append --max-old-space-size=4096 in all node calls inside your node_modules/.bin/* files.

1、全局安装increase-memory-limit

npm install -g increase-memory-limit

2、进入项目目录,执行代码

increase-memory-limit

tips

【1】如出现错误提示'node --max-old-space-size=10240' 不是内部或外部命令,也不是可运行的程序 ,仅需在 node_modules 文件夹中将所有 "%_prog%" 替换成 %_prog% (即去掉双引号)


【2】Node.js v8.0 以上可以按照下面方式设定,不需要使用插件了
export NODE_OPTIONS=--max_old_space_size=4096
posted @ 2022-05-24 17:29  huihuihero  阅读(795)  评论(0编辑  收藏  举报