Ionic Serve 问题 - ng 意外关闭

Ionic Serve 问题 - ng 意外关闭

我执行了这个命令

F:\ionic-firebase-shopping-cart-master>ionic serve

在我的命令提示符中发现了这个问题

ng.cmd run app:serve --host=localhost --port=8100
[ng] The run command requires to be run in an Angular project, but a project definition could not be found.
[ERROR] ng has unexpectedly closed (exit code 1).

        The Ionic CLI will exit. Please check any output above for error details.

请帮我解决这个问题

答案1

通过下面的命令清理你的电脑环境后,再试一次:

npm cache clean --force
npm uninstall -g @angular/cli 
npm uninstall --save @angular/cli

和/或

npm uninstall -g @ionic/cli
npm uninstall --save @ionic/cli
npm install --save-dev @angular/cli@~10.0.5 //or with your version
// npm install --save @ionic/cli  //if necessary
ng build
ionic serve -l --port=8100

尽管这可能与您的 SDK 和 Nodejs 版本有关,但在删除不适当的版本后它应该可以工作。

相关内容