当我使用Ionic serve命令运行Ionic 3项目时,我会得到这个错误:


当前回答

对我来说,当我在React项目中使用一个大的构建目录运行ESLint和Prettier时遇到了这个问题。取出后,一切都正常了。

我想这是因为在构建目录中有太多的文件。

其他回答

我删除了现有的Node.js模块,并运行以下命令来解决我的问题:

npm install -all
npm audit fix

只需在终端中输入以下内容:

export NODE_OPTIONS="--max-old-space-size=8192"

当超过Node.js允许的默认最大内存时,就会发生错误。所有这些操作都增加了允许的最大内存。

更换线路

"start": "ng serve -o——port 4300——configuration= zh " with

"start": "node——max_old_space_size=5096 node_modules/@angular/cli/bin/ng serve -o——port 4300——configuration= zh "

注意:

端口—4300不是常量,这取决于您选择的端口。 ——max_old_space_size=5096 too not constant;任意值1024、2048、4096等

如果这对某人有用的话。确保我们的Sass中没有递归。或者在最近添加的代码中使用不存在的递归。在某些情况下,超过Max堆就是一个标志。

在项目文件夹中运行此命令。使用服务而不是构建

node --max_old_space_size=8000 node_modules/@angular/cli/bin/ng serve  --prod --port=4202