2017-06-02 92 views
2

我創建了一個新項目並安裝了OneSignal插件。安裝OneSignal插件後無法爲ios構建Ionic 3項目

須藤離子科爾多瓦插件添加onesignal - 科爾多瓦 - 插件

須藤NPM安裝--save @離子本地/ onesignal


從那以後,我建的Android還行,但我爲iOS構建。

須藤離子科爾多瓦建設IOS


它給了我類似這樣的消息 - >

Lolzzs-MacBook-Pro:myOnesignal lolzzlolzz$ sudo ionic cordova build ios 
> cordova platform add --save ios 
✖ Running command - failed! 
[ERROR] An error occurred while running cordova platform add --save ios (exit code 1): 

     Using cordova-fetch for [email protected]~4.4.0 
     Adding ios project... 
     Creating Cordova project for the iOS platform: 
       Path: platforms/ios 
       Package: io.ionic.starter 
       Name: MyApp 
     iOS project created with [email protected] 
     Installing "cordova-plugin-console" for ios 
     Installing "cordova-plugin-device" for ios 
     Installing "cordova-plugin-splashscreen" for ios 
     Installing "cordova-plugin-statusbar" for ios 
     Installing "cordova-plugin-whitelist" for ios 
     Installing "ionic-plugin-keyboard" for ios 
     Installing "onesignal-cordova-plugin" for ios 
     Failed to install 'onesignal-cordova-plugin': undefined 
     Error: /usr/local/lib/ruby/gems/2.4.0/gems/claide-1.0.1/lib/claide/command.rb:439:in 
`help!': [!] You cannot run CocoaPods as root. (CLAide::Help) 

     Usage: 

      $ pod COMMAND 

       CocoaPods, the Cocoa library package manager. 

     Commands: 
+ cache  Manipulate the CocoaPods cache 
      + env  Display pod environment 
      + init  Generate a Podfile for the current directory 
      + install Install project dependencies according to versions from a 
         Podfile.lock 
      + ipc  Inter-process communication 
      + lib  Develop pods 
      + list  List pods 
      + outdated Show outdated project dependencies 
      + repo  Manage spec-repositories 
      + setup  Setup the CocoaPods environment 
      + spec  Manage pod specs 
      + update  Update outdated project dependencies and create new Podfile.lock 

     Options: 

      --silent  Show nothing 
      --version Show the version of the tool 
      --verbose Show more debugging information 
      --no-ansi Show output without ANSI codes 
      --help  Show help banner of specified command 
       from /usr/local/lib/ruby/gems/2.4.0/gems/cocoapods-1.2.1/lib/cocoapods/comma 
nd.rb:47:in `run' 
       from /usr/local/lib/ruby/gems/2.4.0/gems/cocoapods-1.2.1/bin/pod:55:in `<top 
(required)>' 
       from /usr/local/bin/pod:22:in `load' 
       from /usr/local/bin/pod:22:in `<main>' 
+0

你爲什麼要使用sudo建設?我認爲在這種情況下,錯誤很明顯:你不能以root身份運行CocoaPods – tier1

+0

你不應該使用sudo來安裝插件 – tier1

+0

@ tier1我使用的是Mac,我把sudo設置爲避免權限被拒絕,但我會再試一次, sudo,謝謝你,我會再次測試:-D –

回答

1

後很長一段時間試圖建立我的項目完全相同的oneSignal錯誤

我看到一條指令去平臺/ ios 和運行:

sudo gem install cocoapods

pod install --repo-update

和工作