问题报错
linux 在开发RN项目时遇到几个报错,记录下
- 内存溢出
<--- Last few GCs --->
[130124:0000021FC62BC9D0] 1795 ms: Scavenge 1762.7 (1796.8) -> 1762.6 (1796.8) MB, 34.4 / 0.0 ms
(average mu = 1.000, current mu = 1.000) allocation failure
[130124:0000021FC62BC9D0] 2409 ms: Mark-sweep 1922.7 (1956.8) -> 1922.0 (1956.1) MB, 487.4 / 0.0 ms
(+ 38.4 ms in 10 steps since start of marking, biggest step 5.0 ms, walltime since start of marking 2053 ms)
(average mu = 1.000, current mu = 1.000)
<--- JS stacktrace --->
- 超过文件监听数量
ENOSPC: System limit for number of file watchers reached
问题解决
- 内存溢出
npm install -g increase-memory-limit # 全局安装
"fix-memory-limit": "cross-env LIMIT=40960 increase-memory-limit" # package.json 加入 然后执行
或者
vim ~/.bashrc
# 增加以下环境变量
export NODE_OPTIONS="--max-old-space-size=8192"
- 超过文件监听数量
sysctl fs.inotify.max_user_watches=524288
sysctl -p