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


当前回答

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

npm install -all
npm audit fix

其他回答

在我的案例中,我通过安装Node.js 12.10.0版本解决了这个问题。

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

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

从Node.js 12更新到Node.js 14为我解决了这个问题。


现在更新Node.js 16可用,我建议更新到Node.js的最新可用版本。

检查文件夹名称。如果文件夹名中有空格,就会产生这类问题。不带空格的重命名。

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

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

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

并运行project this命令:

npm run serve