Ionic package IOS Build fails missing 'xcode' npm module on setManualSigning.js

I run ionic package build ios --profile <my_profile> --release on my project directory and this fail with the following log:

module.js:457
    throw err;
    ^

Error: Cannot find module '/Users/package/workspace/<my_app_dir>/cordova/platforms/ios/cordova/node_modules/xcode'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/package/package-scripts/setManualSigning.js:4:15)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)

Please, help me fix this error, i’ve tried to run npm install xcode in my platforms/ios/cordova and it has been unuseful

My ionic environment is bellow. Update ionic CLI to the latest version (Ionic CLI 3.4.0) didn’t solve nor change the output


Cordova CLI: 6.4.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Distributor ID: Ubuntu Description: Ubuntu 15.04
Node Version: v6.5.0

Does plain ionic build ios work?

I guess it will not work, because i’m on ubuntu, which is a linux. I’ve also tried to update my ionic cli to the latest version and the error is still persisting

I don’t think you have updated ionic/ionic-cli properly.
Try to do a

npm uninstall -g ionic
npm install -g ionic@latest
npm install -g cordova
npm install --save-dev --save-exact @ionic/cli-plugin-cordova@latest

xcode-select --install
npm install -g ios-deploy

Then do an ionic info and post that output

I can’t run xcode-select nor install ios-deploy because i’m on linux. I don’t understand why should i do that. Wouldn’t ionic package command abstract all the build process and dependencies on the cloud? Running the other commands gave me the following ionic info output

global packages:

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

local packages:

@ionic/cli-plugin-cordova : 1.4.0
@ionic/cli-plugin-ionic1  : 2.0.0
Cordova Platforms         : android 5.2.1
Ionic Framework           : ionic1 1.2.4

System:

Node       : v6.5.0
OS         : Linux 3.19
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 3.10.3

Oh sorry about the confusion. Now, your ionic info looks correct. Now, can you create a new project and build that using ionic build ios.

ionic build ios runs locally. As i mentioned before my environment is over linux OS, which doesn’t allow native IOS builds. Didn’t you mean ionic package build ios? I’ve tried to run ionic package again and the output remains the same

Create a new project via ionic start blank and then try to build that using Ionic Package. If that works or doesn’t, we know more and can continue debugging your real problem.

Running ionic package in a blank project yields me a successful output:

id | 2
status | SUCCESS
platform | iOS
mode | release
profile | prod
started | 2017-06-23T14:44:57.238Z
finished | 2017-06-23T14:45:43.261Z

Hm, so it is something with your project. Have you tried removing and re-adding the ios platform already? If not, do so.

Yes i did. If my project has a “package problem” then it should be on package.json. Don’t you think? The strange think is i’ve always built it with the same configuration while in ionic 1. The error presented after some service updates under the ionic 2 era. Maybe my package.json is missing something. What do you think?

{
  "name": "<app_name>",
  "version": "<app_ver>",
  "description": "<app_description>",
  "dependencies": {
    "bower": "^1.7.7",
    "cordova-ios": "^3.9.2",
    "elementtree": "^0.1.6",
    "gulp": "^3.9.1",
    "gulp-changed": "^1.3.0",
    "gulp-concat": "^2.6.0",
    "gulp-jshint": "^2.0.0",
    "gulp-minify-css": "^0.3.13",
    "gulp-ng-annotate": "^2.0.0",
    "gulp-ngmin": "^0.3.0",
    "gulp-rename": "^1.2.2",
    "gulp-sass": "^2.2.0",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-uglify": "^1.5.3",
    "gulp-util": "^3.0.7",
    "ionic-native-transitions": "^1.0.0-rc10",
    "jshint": "^2.9.1",
    "lodash": "^4.13.1",
    "plist": "^1.2.0",
    "shelljs": "^0.6.0",
    "xcode": "^0.9.3"
  },
  "devDependencies": {
    "@ionic/cli-plugin-cordova": "1.4.0",
    "@ionic/cli-plugin-ionic1": "2.0.0",
    "bower": "^1.3.3",
    "gulp": "^3.9.1",
    "gulp-util": "^2.2.14",
    "shelljs": "^0.3.0"
  },
  "cordovaPlugins": [
    "cordova-plugin-device@1.1.2",
    "cordova-plugin-whitelist@1.2.2",
    "cordova-plugin-webserver@1.0.3",
    "cordova-plugin-splashscreen@3.2.2",
    "cordova-plugin-statusbar@2.1.3",
    "ionic-plugin-keyboard@2.0.1",
    "cordova-plugin-wkwebview@0.6.9",
    "com.telerik.plugins.nativepagetransitions",
    {
      "locator": "https://github.com/Wizcorp/phonegap-facebook-plugin",
      "id": "cordova-plugin-facebook",
      "variables": {
        "APP_ID": "<app_id>",
        "APP_NAME": "<app_name>",
        "FACEBOOK_DISPLAY_NAME": "<app_name>",
        "FACEBOOK_APP_ID": "<app_id>"
      }
    },
    "cordova-plugin-crosswalk-webview@1.6.1",
    "cordova-plugin-vibration@2.1.1",
    "cordova-plugin-inappbrowser",
    "onesignal-cordova-plugin"
  ],
  "cordovaPlatforms": [
    {
      "platform": "ios",
      "version": "3.x",
      "locator": "ios@3.x"
    }
  ]
}

It is a package problem inside the cordova project - not your project (see path in your error message). That’s also why I have no idea how to debug this any futher.

Hi, I’m facing the exact same issue. My last successful build on the ionic cloud for ios was on 20th April 2017.
When I tried a build today, it failed with this error
image

Heres my ionic Info

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 6.5.0
Gulp CLI         : not installed globally
Ionic CLI        : 3.4.0

local packages:

@ionic/cli-plugin-cordova : 1.4.0
@ionic/cli-plugin-gulp    : 1.0.1
@ionic/cli-plugin-ionic1  : 2.0.0
Cordova Platforms         : android 6.1.2 browser 4.1.0 ios 4.4.0
Ionic Framework           : ionic1 1.3.1

System:

Node       : v7.8.0
OS         : Linux 3.16
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 4.2.0

My package.json

tnoel@website:~/dev/netglyde-app$ cat package.json
{
“name”: “netglyde-app”,
“version”: “1.1.2”,
“description”: “netglyde-app: An Ionic project”,
“dependencies”: {
“angular-card”: “^0.3.7”,
“angular2-jwt”: “^0.1.24”,
“cordova-ios”: “^4.4.0”,
“gulp”: “^3.5.6”,
“gulp-concat”: “^2.2.0”,
“gulp-minify-css”: “^0.3.0”,
“gulp-rename”: “^1.2.0”,
“gulp-sass”: “^2.0.4”,
“cordova-plugin-camera”: “~2.3.0”,
“cordova-plugin-console”: “~1.0.4”,
“cordova-plugin-device”: “~1.1.3”,
“cordova-plugin-file”: “~4.3.0”,
“cordova-plugin-ios-keychain”: “https://github.com/driftyco/cordova-plugin-ios-keychain.git”,
“cordova-plugin-splashscreen”: “~4.0.0”,
“cordova-plugin-statusbar”: “~2.2.0”,
“cordova-plugin-whitelist”: “~1.3.0”,
“ionic-plugin-keyboard”: “~2.2.1”
},
“devDependencies”: {
"@ionic/cli-plugin-cordova": “1.4.0”,
"@ionic/cli-plugin-gulp": “1.0.1”,
"@ionic/cli-plugin-ionic1": “2.0.0”,
“bower”: “^1.3.3”,
“gulp-util”: “^2.2.14”,
“shelljs”: “^0.3.0”
},
“cordovaPlugins”: [
“cordova-plugin-device”,
“cordova-plugin-whitelist”,
{
“locator”: “https://github.com/apache/cordova-plugin-splashscreen.git”,
“id”: “cordova-plugin-splashscreen”
},
“cordova-plugin-statusbar”,
“ionic-plugin-keyboard”,
“cordova-plugin-compat”,
“cordova-plugin-file”,
“cordova-plugin-media-capture”,
“cordova-plugin-inappbrowser”,
{
“locator”: “https://github.com/driftyco/cordova-plugin-ios-keychain.git”,
“id”: “cordova-plugin-ios-keychain”
},
“cordova-plugin-camera”,
“cordova-plugin-webserver”,
“cordova-plugin-console”,
“cordova-plugin-datepicker”
],
“cordovaPlatforms”: [
{
“platform”: “browser”,
“version”: “”,
“locator”: “browser”
},
{
“platform”: “ios”,
“version”: “4.4.0”,
“locator”: “ios@4.4.0”
}
],
“cordova”: {
“plugins”: {
“cordova-plugin-camera”: {
“CAMERA_USAGE_DESCRIPTION”: “Used only for personlization”,
“PHOTOLIBRARY_USAGE_DESCRIPTION”: “Used only for personlization”
},
“cordova-plugin-console”: {},
“cordova-plugin-device”: {},
“cordova-plugin-file”: {},
“cordova-plugin-ios-keychain”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-whitelist”: {},
“ionic-plugin-keyboard”: {}
},
“platforms”: [
“ios”
]
}
}

You could try updating Cordova CLI and cordova-ios to current versions. Maybe that helps.

Before that maybe tr creating a new project with your current configuraiton:

Yes, I know the blank ionic app will work as this is not an issue with ionic. However, I’m trying to get this to work.
I updated Cordova to 7.0.1 and made some progress. I no longer get the xcode error.

I now have this:
output:
Adding ios project…
Creating Cordova project for the iOS platform:
Path: platforms/ios
Package: com.netglyde.guide
Name: Guide
iOS project created with cordova-ios@4.4.0
Error: cordovaProject.projectConfig.getFileResources is not a function

OK I got it working finally, the right combination right now is

cordova-ios@4.3.0
cordova@7.0.1