kat*_*n A 20 xcode ios ionic-framework angular capacitor
我刚刚创建了一个全新的 Ionic 应用程序,使用命令“ionic start myApp Blank”
\n我添加了必要的角度依赖性以使“离子服务”正常工作。
\n我已经使用以下命令安装了电容器
\nnpm install @capacitor/cli @capacitor/core\nnpx cap init\n\nnpm install @capacitor/ios @capacitor/android\nRun Code Online (Sandbox Code Playgroud)\n我的 Package.json 如下所示,
\n{\n "name": "myApp",\n "version": "0.0.1",\n "author": "Ionic Framework",\n "homepage": "https://ionicframework.com/",\n "scripts": {\n "ng": "ng",\n "start": "ng serve",\n "build": "ng build",\n "test": "ng test",\n "lint": "ng lint",\n "e2e": "ng e2e"\n },\n "private": true,\n "dependencies": {\n "@angular/common": "~12.1.1",\n "@angular/core": "~12.1.1",\n "@angular/forms": "~12.1.1",\n "@angular/platform-browser": "~12.1.1",\n "@angular/platform-browser-dynamic": "~12.1.1",\n "@angular/router": "~12.1.1",\n "@capacitor/android": "^3.2.4",\n "@capacitor/app": "1.0.3",\n "@capacitor/core": "^3.2.4",\n "@capacitor/haptics": "1.1.0",\n "@capacitor/ios": "^3.2.4",\n "@capacitor/keyboard": "1.1.0",\n "@capacitor/status-bar": "1.0.3",\n "@ionic/angular": "^5.5.2",\n "rxjs": "~6.6.0",\n "tslib": "^2.2.0",\n "zone.js": "~0.11.4"\n },\n "devDependencies": {\n "@angular-devkit/build-angular": "~12.1.1",\n "@angular-eslint/builder": "~12.0.0",\n "@angular-eslint/eslint-plugin": "~12.0.0",\n "@angular-eslint/eslint-plugin-template": "~12.0.0",\n "@angular-eslint/template-parser": "~12.0.0",\n "@angular/cli": "~12.1.1",\n "@angular/compiler": "~12.1.1",\n "@angular/compiler-cli": "~12.1.1",\n "@angular/language-service": "~12.0.1",\n "@capacitor/cli": "^3.2.4",\n "@ionic/angular-toolkit": "^4.0.0",\n "@types/jasmine": "~3.6.0",\n "@types/jasminewd2": "~2.0.3",\n "@types/node": "^12.11.1",\n "@typescript-eslint/eslint-plugin": "4.16.1",\n "@typescript-eslint/parser": "4.16.1",\n "eslint": "^7.6.0",\n "eslint-plugin-import": "2.22.1",\n "eslint-plugin-jsdoc": "30.7.6",\n "eslint-plugin-prefer-arrow": "1.2.2",\n "jasmine-core": "~3.8.0",\n "jasmine-spec-reporter": "~5.0.0",\n "karma": "~6.3.2",\n "karma-chrome-launcher": "~3.1.0",\n "karma-coverage": "~2.0.3",\n "karma-coverage-istanbul-reporter": "~3.0.2",\n "karma-jasmine": "~4.0.0",\n "karma-jasmine-html-reporter": "^1.5.0",\n "protractor": "~7.0.0",\n "ts-node": "~8.3.0",\n "typescript": "~4.2.4"\n },\n "description": "An Ionic project"\n}\n\nRun Code Online (Sandbox Code Playgroud)\n我运行了以下命令,效果很好
\nrm -r "./www"\nrm -r "./ios"\nng build\nRun Code Online (Sandbox Code Playgroud)\n之后我尝试运行以下命令\n ionic capacitor add ios\n(或)\nnpx cap add ios
错误如下
\n\xe2\x9c\x94 Adding native Xcode project in ios in 29.98ms\n\xe2\x9c\x94 add in 30.56ms\n\xe2\x9c\x94 Copying web assets from www to ios/App/App/public in 864.98ms\n\xe2\x9c\x94 Creating capacitor.config.json in ios/App/App in 699.86\xce\xbcp\n(node:25320) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/493055/Desktop/dev/IonicExperiment/myApp/node_modules/tslib/package.json.\nUpdate this package.json to use a subpath pattern like "./*".\n(Use `node --trace-deprecation ...` to show where the warning was created)\n\xe2\x9c\x94 copy ios in 908.37ms\n\xe2\x9c\x94 Updating iOS plugins in 5.66ms\n[info] Found 4 Capacitor plugins for ios:\n @capacitor/app@1.0.3\n @capacitor/haptics@1.1.0\n @capacitor/keyboard@1.1.0\n @capacitor/status-bar@1.0.3\n\xe2\x9c\x96 Updating iOS native dependencies with pod install - failed!\n\xe2\x9c\x96 update ios - failed!\n[error] ERR_SUBPROCESS_NON_ZERO_EXIT\nRun Code Online (Sandbox Code Playgroud)\n和
\n(base) AMBIN01978:myApp 493055$ ionic capacitor add ios\n> npm i -E @capacitor/ios@latest\nnpm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/\nnpm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/\n\n\nup to date in 5s\n\n136 packages are looking for funding\n run `npm fund` for details\n> capacitor add ios\n[capacitor] \xe2\x9c\x94 Adding native Xcode project in ios in 32.31ms\n[capacitor] \xe2\x9c\x94 add in 33.30ms\n[capacitor] \xe2\x9c\x94 Copying web assets from www to ios/App/App/public in 696.66ms\n[capacitor] \xe2\x9c\x94 Creating capacitor.config.json in ios/App/App in 446.33\xce\xbcp\n[capacitor] (node:25522) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/493055/Desktop/dev/IonicExperiment/myApp/node_modules/tslib/package.json.\n\n[capacitor] Update this package.json to use a subpath pattern like "./*".\n[capacitor] (Use `node --trace-deprecation ...` to show where the warning was created)\n[capacitor] \xe2\x9c\x94 copy ios in 715.44ms\n[capacitor] \xe2\x9c\x94 Updating iOS plugins in 4.48ms\n[capacitor] [info] Found 4 Capacitor plugins for ios:\n[capacitor] @capacitor/app@1.0.3\n[capacitor] @capacitor/haptics@1.1.0\n[capacitor] @capacitor/keyboard@1.1.0\n[capacitor] @capacitor/status-bar@1.0.3\n[capacitor] \xe2\x9c\x96 Updating iOS native dependencies with pod install - failed!\n[capacitor] \xe2\x9c\x96 update ios - failed!\n[capacitor] [error] xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance\n[capacitor] \n[ERROR] An error occurred while running subprocess capacitor.\n \n capacitor add ios exited with exit code 1.\n \n Re-running this command with the --verbose flag may provide more information.\nRun Code Online (Sandbox Code Playgroud)\n这几天我一直被这个问题伤透了脑筋。任何帮助是极大的赞赏
\nkat*_*n A 70
我在终端中运行了以下命令
sudo xcode-select --reset
并为我摆脱了错误
J0h*_*nes 41
如果您有 M1 - 问题可能出在 Cocoapods 上。
如果这里的其他答案失败,请尝试:
sudo arch -x86_64 gem install ffi
然后在ios/App内
arch -x86_64 pod 安装
然后,看看它是否有效:
光盘..
光盘..
npx 上限同步
| 归档时间: |
|
| 查看次数: |
25612 次 |
| 最近记录: |