Ionic 4 - 当我 运行 "ionic server" 时获取 [ERROR] ng 意外关闭(退出代码 1)
Ionic 4 - Getting [ERROR] ng has unexpectedly closed (exit code 1) when I run "ionic server"
当我在 Ionic4 项目上尝试第一个 运行 时,我遇到了这个错误。
ng run app:serve --host=0.0.0.0 --port=8100
[ERROR] ng has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error details.
我正在使用 Linux Elementary OS(来自 Ubuntu 的一个不错的发行版)。
我尝试 运行 一个 ionic3 项目,它 运行 成功了。
当我 运行 ionic serve --verbose 我收到这条消息
我已经尝试了很多东西,"npm cache clean",重新安装 node,重新安装 ionic,start/stop nodejs 进程。但没有任何成功。
由于我找不到任何人遇到与我完全相同的问题,所以我问你们。
我发现如果我将文件从创建文件的原始文件夹复制到新文件夹中,就会出现该错误。但是如果我从它的原始文件夹中提供它,它第一次工作。
我还确保安装了最新的 npm 和节点。
问题是我的 NodeJS 版本和 JDK。
我使用 "nvm use 8.12.0" 指向支持的节点版本。另外我必须更改我的 JDK 的版本,我使用 openJDK 8.
我在 运行 ionic 服务时遇到错误,ionic 命令行界面 (CLI) 将退出。
所以首先我删除了我的 node_modules 文件夹,但它没有解决。
最后解析为运行下面我提到的命令行:
npm install @ionic/app-scripts@latest --save-dev
重新安装以下软件包...
npm install @ionic/app-scripts@latest --save-dev
And just change PATHEXT if there is space or ; at last then remove it
首先你必须从项目中删除节点模块文件夹。
然后 运行 下面的命令
npm cache clean --force
之后运行
npm i
终于可以运行
ionic serve
1: 打开你的项目根文件夹
2: 删除 node_modules 文件夹
3: 运行 npm install
此解决方案有效...希望对您有所帮助!
需要指定类型
运行 下面的命令
ionic start myApp tabs --type=ionic1
有没有可能在创建这个 Ionic project/app 时它得到了互联网问题或网络相关问题的提示,没有安装所有需要的依赖项?
尝试创建一个新的 ionic 项目分支,然后 cd 进入它并 运行 ionic serve 看看是否一切顺利。
祝你好运
我知道您的问题已解决,但您也可以在终端中应用以下命令
npm cache clean --force
npm uninstall -g @angular/cli
npm uninstall -g @ionic/cli
您还可以使用替代 路径删除软件包:- C:\Users\user_Name\AppData\Roaming
在 Roaming 文件夹中删除 npm 文件夹
它会删除您之前安装的所有软件包(angular/ionic 等)
最后重新安装所有依赖项
npm install -g @angular/cli
npm install -g @ionic/cli
首先安装angular然后创建离子项目这对我来说已经解决了。
npm cache clean --force
npm uninstall -g @angular/cli
npm uninstall -g @ionic/cli
npm install -g @angular/cli
npm install -g @ionic/cli
这取决于你的错误:
[ERROR] ng has unexpectedly closed (exit code 1).
告诉你,它不能运行服务器,你需要像它所说的那样观察错误:
The Ionic CLI will exit. Please check any output above for error details.
对我来说,它在 (phase:setup)
中抛出错误
那你就开车去读吧:
throw new Error("Depend of your error")
Error: Depend of your error
找到这一行后,你可以在Whosebug中搜索或者google如何解决错误。
对我来说这是一个缺少的依赖项,我只是安装它:
Error: The target entry-point "@ionic-native/file" has missing dependencies:
- @ionic-native/core
解决方法:
npm i @ionic-native/core
当我在 Ionic4 项目上尝试第一个 运行 时,我遇到了这个错误。
ng run app:serve --host=0.0.0.0 --port=8100
[ERROR] ng has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error details.
我正在使用 Linux Elementary OS(来自 Ubuntu 的一个不错的发行版)。
我尝试 运行 一个 ionic3 项目,它 运行 成功了。
当我 运行 ionic serve --verbose 我收到这条消息
我已经尝试了很多东西,"npm cache clean",重新安装 node,重新安装 ionic,start/stop nodejs 进程。但没有任何成功。 由于我找不到任何人遇到与我完全相同的问题,所以我问你们。
我发现如果我将文件从创建文件的原始文件夹复制到新文件夹中,就会出现该错误。但是如果我从它的原始文件夹中提供它,它第一次工作。
我还确保安装了最新的 npm 和节点。
问题是我的 NodeJS 版本和 JDK。
我使用 "nvm use 8.12.0" 指向支持的节点版本。另外我必须更改我的 JDK 的版本,我使用 openJDK 8.
我在 运行 ionic 服务时遇到错误,ionic 命令行界面 (CLI) 将退出。
所以首先我删除了我的 node_modules 文件夹,但它没有解决。
最后解析为运行下面我提到的命令行:
npm install @ionic/app-scripts@latest --save-dev
重新安装以下软件包...
npm install @ionic/app-scripts@latest --save-dev
And just change PATHEXT if there is space or ; at last then remove it
首先你必须从项目中删除节点模块文件夹。
然后 运行 下面的命令
npm cache clean --force
之后运行
npm i
终于可以运行
ionic serve
1: 打开你的项目根文件夹
2: 删除 node_modules 文件夹
3: 运行 npm install
此解决方案有效...希望对您有所帮助!
需要指定类型 运行 下面的命令
ionic start myApp tabs --type=ionic1
有没有可能在创建这个 Ionic project/app 时它得到了互联网问题或网络相关问题的提示,没有安装所有需要的依赖项?
尝试创建一个新的 ionic 项目分支,然后 cd 进入它并 运行 ionic serve 看看是否一切顺利。
祝你好运
我知道您的问题已解决,但您也可以在终端中应用以下命令
npm cache clean --force
npm uninstall -g @angular/cli
npm uninstall -g @ionic/cli
您还可以使用替代 路径删除软件包:- C:\Users\user_Name\AppData\Roaming
在 Roaming 文件夹中删除 npm 文件夹 它会删除您之前安装的所有软件包(angular/ionic 等)
最后重新安装所有依赖项
npm install -g @angular/cli
npm install -g @ionic/cli
首先安装angular然后创建离子项目这对我来说已经解决了。
npm cache clean --force
npm uninstall -g @angular/cli
npm uninstall -g @ionic/cli
npm install -g @angular/cli
npm install -g @ionic/cli
这取决于你的错误:
[ERROR] ng has unexpectedly closed (exit code 1).
告诉你,它不能运行服务器,你需要像它所说的那样观察错误:
The Ionic CLI will exit. Please check any output above for error details.
对我来说,它在 (phase:setup)
那你就开车去读吧:
throw new Error("Depend of your error")
Error: Depend of your error
找到这一行后,你可以在Whosebug中搜索或者google如何解决错误。
对我来说这是一个缺少的依赖项,我只是安装它:
Error: The target entry-point "@ionic-native/file" has missing dependencies:
- @ionic-native/core
解决方法:
npm i @ionic-native/core