Visual Studio Team Services Support

Computer screen showing a question mark. Community, documentation, and status update solutions.

VSTS status

We are here to help

Troubleshooting tips for building on Mac

iOS/OSX Gotchas: Troubleshooting Tips for Building on a Mac

There are a few relativley common issues when building a Cordova app on OSX related to permissions that are worth noting.
  1. You are seeing permission errors from "npm": If you are seeing permission errors from "npm," you may be running into a situation where the build agent user's cache folder (~/.npm) is inaccessible. Generally this occurs if the folder or some of its contents was created while running as an administrator (sudo). Fortunately this is easy to resolve:
    1. Log into OSX with the user that installed and set up the cross-platform agent
    2. Open the Terminal app and type:
      sudo npm cache clear
      
    3. Next, type:
      sudo chown -R `whoami` ~/.npm
      
  2. You checked in the "hooks" folder from Windows and are seeing "spawn EACCES" errors: If you encounter a "spawn EACCES" error when building on a Mac or Linux, be sure all files in the hooks folder to have an "execute bit" set as this a requirement for Cordova. To resolve, add an execute bit to the files in source control or execute a set of chmod commands as a part of your build script. Ex:
    chmod +x <file name goes here>
    
    This is commonly seen with Ionic due to the hook in hooks/after_prepare.
  3. You checked in the "platforms" folder from Windows and are seeing permission errors: You should not run into this situation if you are using the Visual Studio Team Services Extension for Cordova, but if you are seeing errors that are originating from files in your project's "platforms" folder, the root cause may be that you checked in shell scripts under the "platforms/android/cordova" or "platforms/ios/cordova" folders from Windows. This is because the NTFS file system has no concept of an "execute bit" that is required to run these from OSX. (The contents of the platforms is generally not intended for checked in and by default are excluded from Cordova projects in Visual Studio as a result.) For example, this error is saying the "version" script is not executable:
    [17:41:57] Error:
    /Users/vsoagent/vsoagent/agent/work/build/b424d56537be4854de825289f019285698609afddf826d5d1a185eb60b806e47/repo/tfs-vnext test/platforms/android/cordova/version:
    Command failed with exit code EACCES
    
To resolve this problem you have two options:
  1. Don't check in the contents of the "platforms" folder into source control. This is by far the path of least resistance. The Gulp build script can add them at the time you build.
  2. If you absolutely must check in the contents of the platforms folder from Windows, you can craft a shell script to set the execute bits on these files and include it as a part of your build process. There is a Cordova hook based version of this script available in the tips and workarounds section.
    1. Signing suddenly stopped working for iOS on Feb 14th, 2016. Apple's WWDR certificate expired on Feb 14th and as a result you may experience signing failures if you have not updated the cert and removed the old one. Follow the steps outlined by Apple under What should I do if Xcode doesn’t recognize my distribution certificate? to resolve the problem. Note that this also affects development certs despite the title.

🗨 Need a fast response? Chat with our support bot

Bot is currently in beta and can help answer configuration, build, and release questions. Help us improve the experience by answering the survey after your chat.

Contact us!