首页 > 解决方案 > 如何修复 Firebase Analytics 插件安装错误

问题描述

我正在尝试使用在我的 ionic 项目中安装 firebase 分析插件

sudo ionic cordova plugin add cordova-plugin-firebase-analytics

但我将此作为我的错误并且未安装插件。我已经尝试过 pod install 和 pod update 但它仍然给出同样的错误

> cordova plugin add cordova-plugin-firebase-analytics
Installing "cordova-plugin-firebase-analytics" for ios
Failed to install 'cordova-plugin-firebase-analytics': undefined
CordovaError: Promise rejected with non-error: '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/rbconfig.rb:215: warning: Insecure world writable dir /Users/villifixinc/Documents/TravelApp in PATH, mode 040777\n/Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:439:in `help!\': \u001b[31m[!] You cannot run CocoaPods as root.\u001b[39m (CLAide::Help)\n\n\u001b[4mUsage:\u001b[24m\n\n    $ \u001b[32mpod\u001b[39m \u001b[32mCOMMAND\u001b[39m\n\n      CocoaPods, the Cocoa library package manager.\n\n\u001b[4mCommands:\u001b[24m\n\n    \u001b[32m+ cache\u001b[39m      Manipulate the CocoaPods cache\n    \u001b[32m+ env\u001b[39m        Display pod environment\n    \u001b[32m+ init\u001b[39m       Generate a Podfile for the current directory\n    \u001b[32m+ install\u001b[39m    Install project dependencies according to versions from a\n                 Podfile.lock\n    \u001b[32m+ ipc\u001b[39m        Inter-process communication\n    \u001b[32m+ lib\u001b[39m        Develop pods\n    \u001b[32m+ list\u001b[39m       List pods\n    \u001b[32m+ outdated\u001b[39m   Show outdated project dependencies\n    \u001b[32m+ repo\u001b[39m       Manage spec-repositories\n    \u001b[32m+ setup\u001b[39m      Setup the CocoaPods environment\n    \u001b[32m+ spec\u001b[39m       Manage pod specs\n    \u001b[32m+ update\u001b[39m     Update outdated project dependencies and create new Podfile.lock\n\n\u001b[4mOptions:\u001b[24m\n\n    \u001b[34m--silent\u001b[39m     Show nothing\n    \u001b[34m--version\u001b[39m    Show the version of the tool\n    \u001b[34m--verbose\u001b[39m    Show more debugging information\n    \u001b[34m--no-ansi\u001b[39m    Show output without ANSI codes\n    \u001b[34m--help\u001b[39m       Show help banner of specified command\n\tfrom /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:47:in `run\'\n\tfrom /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>\'\n\tfrom /usr/local/bin/pod:22:in `load\'\n\tfrom /usr/local/bin/pod:22:in `<main>\'\n'
    at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:29:15)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[ERROR] An error occurred while running subprocess cordova.

        cordova plugin add cordova-plugin-firebase-analytics exited with exit
        code 1.

        Re-running this command with the --verbose flag may provide more
        information.

标签: firebaseionic-frameworkfirebase-analytics

解决方案


尝试安装旧版本的插件。2.0.3 版应该可以解决您的问题。


推荐阅读