我正在开发一个使用 oneSignal 插件的 Ionic 应用程序。我的项目是在Windows下开发的,插件运行得很好。但是当我在 mac 上恢复我的项目时,插件拒绝安装
1)我使用 git 命令获取我的项目
2)我打开对我的项目文件夹的访问权限
3)我添加:
sudo npm i --unsafe-perm
sudo gem install cocoapods
pod setup
pod repo update
4)最后当我添加时
sudo cordova platform add ios@latest
我收到此警告:
"framework" tag with type "podspec" is deprecated and will be removed. Please use the "podspec" tag.
Failed to install 'onesignal-cordova-plugin': undefined
Failed to restore plugin "onesignal-cordova-plugin" from config.xml. You might need to try adding it again.
Error: /Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:439:in `help!':
[!] You cannot run CocoaPods as root. (CLAide::Help)
如果我尝试再次卸载并安装 oneSignal,我会收到此警报:
"framework" tag with type "podspec" is deprecated and will be removed. Please use the "podspec" tag.
Failed to install 'onesignal-cordova-plugin': undefined
CordovaError: Promise rejected with non-error: '/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'
我发现建议在不使用 sudo 的情况下安装 oneSignal 插件,但是当我这样做时,我收到此错误消息:
Error: EACCES: permission denied, open '/Users/macos/Library/Preferences/insight-nodejs/insight-cordova.json.1999532748'
Cordova -v:9.0.0([email protected])- ionic -v:5.2.3
你知道这个问题吗?
最佳答案
请安装xcode 11.5
cordova platform remove ios
brew install cocoapods --build-from-source
brew link --overwrite cocoapods
cordova platform add ios
然后就可以了
关于cordova - 在 Mac 上,无法在 Ionic 上安装 oneSignal 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60153505/