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


当前回答

我想有很多方法可以达到这个错误!

在我这边,我的package.json中有一个循环。项目A依赖于项目B,项目B又依赖于项目A。

其他回答

由于某些原因,之前所有的答案对我都不起作用。我做了以下来解决我的问题:

我必须首先删除node_modules文件夹 在我的电脑上重新安装Node.js 然后安装NPM

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

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

我没有使用ng build,而是在终端中执行以下命令来修复这个问题。

 node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod

那就发球吧。

这就是我的终端机

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS D:\ProjectPath\Project1> node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod

我想有很多方法可以达到这个错误!

在我这边,我的package.json中有一个循环。项目A依赖于项目B,项目B又依赖于项目A。

我在Angular上也遇到了同样的问题。然后我写了

"serve": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng serve"

要打包的脚本。Json脚本,为我解决了这个问题。

并运行project this命令:

npm run serve