在将 Angular 7 升级到 8 时,当我运行
ng update
命令进行 @angular/core 迁移时出现了 "Out of memory" 错误。FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
这并不是特别令人惊讶 - 当我运行ng build
时,会出现内存不足
的问题。解决办法是运行npm run build
,它配置为node --max_old_space_size=10240 ./node_modules/@angular/cli/bin/ng build
所以,我的问题是如何配置迁移@angular/core包以使用更多内存?
更新:根据建议,我重新运行了更新。
node --max_old_space_size=10240 ./node_modules/.bin/ng update @angular/core --from 7 --to 8 --migrate-only
但是我遇到了一个错误:
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
看起来这些引号是为 Linux 环境而设计的,在 Windows 上会出问题...