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.
- 全局安装
increase-memory-limit
npm install -g increase-memory-limit
- 进入工程目录,执行 :
increase-memory-limit
- 如出现错误提示
'node --max-old-space-size=10240' 不是内部或外部命令,也不是可运行的程序
,仅需在node_modules
文件夹中将所有"%_prog%"
替换成%_prog%
(即去掉双引号)
注意:Node.js v8.0 以上可以按照下面方式设定,不需要使用插件了
export NODE_OPTIONS=--max_old_space_size=4096