我需要运行一个旧的 ionic 项目,下面给出了使用的节点版本。
# README #
This README would normally document whatever steps are necessary to get your application up and running.
### What is this repository for? ###
* Quick summary
* Version
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
### IONIC INFO ###
Ionic:
* Ionic CLI : 5.4.16
* Ionic Framework : ionic-angular 3.9.5
* @ionic/app-scripts : 3.2.3
Capacitor:
* Capacitor CLI : 2.4.7
* @capacitor/core : 2.4.7
Cordova:
* Cordova CLI : 11.0.0
* Cordova Platforms : android 9.1.0
* Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 26 other plugins)
Utility:
* cordova-res (update available: 0.15.4) : 0.15.3
* native-run (update available: 1.7.1) : 1.5.0
System:
* Android SDK Tools : 26.1.1
* NodeJS : v14.16.1
* npm : 6.14.12
* OS : Windows 10
但是当我在节点版本 14.16.1 上运行时,它表明
块引用 您的 Node.js 版本是 v14.16.1。 Node.js 14 已于 2023 年 4 月 30 日终止,不再受支持。请更新到最新的 Node LTS 版本 块引用
所以我将节点版本升级到18.19.0
并运行命令“ionic cordova run android”,它显示一个错误
块引用 [信息] 找到适用于 Android 的硬件设备。使用--device。 ng.cmd 运行应用程序:ionic-cordova-build --platform=android 错误:在工作区之外运行 Angular CLI 时,此命令不可用。 [错误] 运行子进程 ng 时发生错误。
ng.cmd run app:ionic-cordova-build --platform=android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
块引用
Angular cli 已安装,也尝试卸载并重新安装。 有什么办法解决这个问题吗
我在运行旧的 Ionic 项目时遇到了同样的问题。 这是我的项目信息:
Ionic:
Ionic CLI : 5.4.16 (/Users/canh/.nvm/versions/node/v16.20.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.11.13
@angular-devkit/build-angular : 0.13.10
@angular-devkit/schematics : 7.3.10
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1
Cordova:
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 28 other plugins)
Utility:
cordova-res : 0.15.4
native-run (update available: 2.0.0) : 1.7.2
要解决此问题,请切换回 NodeJS v14.16.1,然后安装旧版本的 Cordova:
npm install -g [email protected]
然后重新安装您的
node_modules