Build failed in Xcode with the error caused by: script error: osascript: no such component "JavaScript".

Unable to build or archive my app in Xcode. It failed with the below error


I am using the Xcode 11.3.1 and macOs 10.15.3(macOS Catalina)


Continuing in background.
error: Failed to display Xcode notification
  caused by: script error: osascript: no such component "JavaScript".

Posted on Mar 16, 2020 11:57 PM

Reply
7 replies

Mar 17, 2020 3:22 AM in response to beulah240

Hard to tell without seeing the offending osascript invocation from your code. You have probably caught the error by now. If you are setting up NSTask/Process, did you review the launchPath and arguments settings? The osascript requirement for using JavaScript is:


osascript -l JavaScript


and the osascript binary is in /usr/bin. If this wasn't an NSTask/Process error, then the Safari scripting dictionary refers to:


do JavaScript


Mar 19, 2020 4:21 AM in response to beulah240

You are using third-party frameworks in Xcode. Since you received an osascript and JavaScript error message, I would start looking in RCTJavaScriptLoader.m and/or contact the provider of that code, and/or their support site.


The code snippet that I provided above is something I wrote to launch a script (or application) via NSTask, and read the output from that process from a pipe back into Objective-C. It could be a Python program that I pass a value to, and then displays a custom NSAlert via PyObjC. In the example code, it is a JavaScript for Automation (JXA) script that is being run from osascript (as JavaScript) and simply returns the list of files on the Desktop.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Build failed in Xcode with the error caused by: script error: osascript: no such component "JavaScript".

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.