Error when packaging for IOS


#1

ionic package info 2 --verbose

Task: title=package, name=package, summary=Use Ionic Package to build your app, <command>=build android, build ios, list, info, or download, [options]=, --release=(build <platform>) Mark this build as a release, --profile|-p <tag>=(build <platform>) Specify the Security Profile to use with this build, --noresources=(build <platform>) Do not generate icon and splash screen resources during this build, --destination|-d <path>=(download) Specify the destination directory to download your packaged app., module=./ionic/package, isProjectTask=true, run=function run(ionic, argv) {
  var cmd;

  if (argv._.length < 2) {
    cmd = 'list';
  } else {
    cmd = argv._[1];
  }

  var dir = null;
  var project = null;
  var appId = null;

  try {
    dir = process.cwd();
    project = Project.load(dir);
    appId = project.get('app_id');

    if (!appId) {
      throw new Error('Missing Ionic App ID. Make sure to run "ionic upload" first or set ' +
        'your app_id in the ionic.config.json file.');
    }
  } catch (ex) {
    return fail(ex, 'package');
  }

  switch (cmd) {
  case 'build':
    return packageBuild(ionic, argv, dir, project, appId);
  case 'list':
    return packageList(ionic, argv, dir, project, appId);
  case 'info':
    return packageInfo(ionic, argv, dir, project, appId);
  case 'download':
    return packageDownload(ionic, argv, dir, project, appId);
  }

  return fail("Unknown subcommand '" + cmd + "'.", 'package');
}
Looking up Ionic root, cwd: D:\Projects\trt\client
Ionic root directory:  D:\Projects\trt\client
Package.json found scripts: clean=ionic-app-scripts clean, build=ionic-app-scripts build, ionic:build=ionic-app-scripts build, ionic:serve=ionic-app-scripts serve

Npm scripts: clean=ionic-app-scripts clean, build=ionic-app-scripts build, ionic:build=ionic-app-scripts build, ionic:serve=ionic-app-scripts serve
Gulpfile found: false

Caught exception:
 SyntaxError: Unexpected end of JSON input
    at Object.parse (native)
    at Request._callback (C:\Users\royib\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\lib\package.js:117:27)
    at Request.self.callback (C:\Users\royib\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\request\request.js:373:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (C:\Users\royib\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\request\request.js:1318:14)
    at emitOne (events.js:101:20)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (C:\Users\royib\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\request\request.js:1266:12)
    at emitNone (events.js:91:20)

ionic info

Your system information:

ordova CLI: 7.0.1
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.6
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.5
Xcode version: Not installed


#2

That is here: https://github.com/ionic-team/ionic-app-lib/blob/master/lib/package.js#L117
Strange.

I would advise you to just upgrade ionic and app-scripts as a first step: npm install -g ionic and npm install @ionic/app-scripts --save-dev.


#3

Done and done.

When executing

npm install @ionic/app-scripts --save-dev

I got the following error though:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})
npm WARN @ionic/cli-plugin-ionic-angular@1.3.0 requires a peer of @ionic/app-scripts@^1.3.7 but none was installed.
npm ERR! code 1

and when trying to package again I’m getting a different result:

ionic package info 3 --verbose

The log is 10 times bigger than the allowed post length limit in this forum, but I think the bottom line there is:

Check dependencies
No signing certificate “iOS Development” found: No “iOS Development” signing certificate matching team ID “5D84Y5K8X9” with a private key was found.
Code signing is required for product type ‘Application’ in SDK ‘iOS 10.2’

** ARCHIVE FAILED **

The following build commands failed:
Check dependencies
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/package/workspace/apps-bb58c5b5-3/cordova/platforms/ios/cordova/build-debug.xcconfig,-workspace,Urban Sentry.xcworkspace,-scheme,Urban Sentry,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,Urban Sentry.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/package/workspace/apps-bb58c5b5-3/cordova/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/package/workspace/apps-bb58c5b5-3/cordova/platforms/ios/build/sharedpch

Which is pretty weird given I created all the certifications required and uploaded them in the app dashboard.

I followed this:

Any idea what I might be missing / could’ve done wrong based on the error?


#4

Ok but updating fixed the old problem.

Can you post ‘ionic info’ output and the command you are executing again to build please.


#5

Sure.

ionic info

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.6
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3 ios 4.4.0
Ionic Framework                 : ionic-angular 3.1.1

System:

Node       : v6.9.5
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 3.10.10

The command I’m executing to build is

ionic package build ios --profile urban_sentry_dev

I’m following this doc:


#6

You should upgrade that to 1.3.7: npm install @ionic/app-scripts --save-dev

You followed the directions and did the certificate dance I suppose? If you think you did everything right and it is still nor working and complaining about certificates: http://ionicframework.com/support#support
(Scroll down to “Business and Customer Support”)


#7

I did that, perhaps the errors I got prevented it from upgrading?[quote=“royibernthal, post:3, topic:95173”]
npm install @ionic/app-scripts --save-dev

I got the following error though:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})
npm WARN @ionic/cli-plugin-ionic-angular@1.3.0 requires a peer of @ionic/app-scripts@^1.3.7 but none was installed.
npm ERR! code 1
[/quote]


#8

Ok, this is strange (and sorry I skipped it).

Show us your package.json please. Change 1.3.6 to 1.3.7 there manually, delete node_modules and run npm install.


#9

Done.

ionic info

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.8
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3 ios 4.4.0
Ionic Framework                 : ionic-angular 3.1.1

System:

Node       : v6.9.5
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 3.10.10

ionic package info 6 --verbose (bottom line)

Check dependencies
No signing certificate “iOS Development” found: No “iOS Development” signing certificate matching team ID “5D84Y5K8X9” with a private key was found.
Code signing is required for product type ‘Application’ in SDK ‘iOS 10.2’

** ARCHIVE FAILED **

The following build commands failed:
Check dependencies
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/package/workspace/apps-bb58c5b5-6/cordova/platforms/ios/cordova/build-debug.xcconfig,-workspace,Urban Sentry.xcworkspace,-scheme,Urban Sentry,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,Urban Sentry.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/package/workspace/apps-bb58c5b5-6/cordova/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/package/workspace/apps-bb58c5b5-6/cordova/platforms/ios/build/sharedpch

package.json

{
“name”: “urban-sentry”,
“version”: “0.0.0”,
“author”: “Royi Bernthal”,
“homepage”: “http://urbansentry.com/”,
“private”: true,
“scripts”: {
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
},
“dependencies”: {
"@angular/common": “4.0.2”,
"@angular/compiler": “4.0.2”,
"@angular/compiler-cli": “4.0.2”,
"@angular/core": “4.0.2”,
"@angular/forms": “4.0.2”,
"@angular/http": “4.0.2”,
"@angular/platform-browser": “4.0.2”,
"@angular/platform-browser-dynamic": “4.0.2”,
"@ionic-native/core": “^3.6.1”,
"@ionic-native/screen-orientation": “^3.6.1”,
"@ionic-native/splash-screen": “3.4.2”,
"@ionic-native/status-bar": “3.4.2”,
"@ionic/cloud-angular": “^0.12.0”,
"@ionic/storage": “2.0.1”,
"@types/gsap": “^1.19.1”,
"@types/howler": “^2.0.2”,
“cordova-android”: “^6.2.3”,
“cordova-ios”: “^4.4.0”,
“cordova-plugin-console”: “1.0.5”,
“cordova-plugin-device”: “1.1.4”,
“cordova-plugin-screen-orientation”: “~2.0.1”,
“cordova-plugin-splashscreen”: “~4.0.1”,
“cordova-plugin-statusbar”: “2.2.1”,
“cordova-plugin-whitelist”: “1.3.1”,
“es6-promise-plugin”: “git+https://github.com/vstirbu/PromisesPlugin.git”,
“gsap”: “^1.19.1”,
“howler”: “^2.0.3”,
“ionic-angular”: “3.1.1”,
“ionic-plugin-keyboard”: “~2.2.1”,
“ionicons”: “3.0.0”,
“rxjs”: “5.1.1”,
“sw-toolbox”: “3.4.0”,
“zone.js”: “^0.8.5”
},
“devDependencies”: {
"@ionic/app-scripts": “^1.3.7”,
"@ionic/cli-plugin-cordova": “1.4.0”,
"@ionic/cli-plugin-ionic-angular": “1.3.1”,
“typescript”: “~2.2.1”
},
“cordovaPlugins”: [
“cordova-plugin-whitelist”,
“cordova-plugin-console”,
“cordova-plugin-statusbar”,
“cordova-plugin-device”,
“ionic-plugin-keyboard”,
“cordova-plugin-splashscreen”
],
“cordovaPlatforms”: [],
“description”: “Urban Sentry- Train your reflexes”,
“cordova”: {
“plugins”: {
“cordova-plugin-console”: {},
“cordova-plugin-device”: {},
“cordova-plugin-screen-orientation”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-whitelist”: {},
“ionic-plugin-keyboard”: {}
},
“platforms”: [
“android”,
“ios”
]
}
}

I sent a bug report to ionic support. Should I also open a github issue?

Do you think the certificates could be the problem? If so perhaps recreating them could help? (although I’m not sure what I could do differently)


#10

Good. No, there are not Github issues for Ionic Package stuff - that is all handled via support.

You could try that. Maybe with another, empty project that you create just to test this maybe? Otherwise you will destroy the possibility for the support team to debug your current app.


#11

Support suggested the problem is with the certificates.

I recreated them from scratch and it works now.
I’m not sure what I got wrong last time but certificates were definitely the problem.

Thank you for the help :slight_smile:


#12

Certificates are a pain. Great you got it working.