When attempting to build the iOS app with Ionic, the error "Unable to access property toLowerCase of undefined" is

When attempting to build ios in Ionic3 using the command: ionic cordova build ios, I encounter the error "Cannot read property toLowerCase of undefined".

Below is the log output with the --verbose flag:

> ionic-app-scripts build --target cordova --platform ios
[12:09:39]  ionic-app-scripts 3.1.11 
[12:09:39]  build dev started ... 
[12:09:39]  clean started ... 
[12:09:39]  clean finished in 4 ms 
[12:09:39]  copy started ... 
[12:09:39]  deeplinks started ... 
[12:09:40]  deeplinks finished in 104 ms 
[12:09:40]  transpile started ... 
[12:09:43]  transpile finished in 3.15 s 
[12:09:43]  preprocess started ... 
[12:09:43]  preprocess finished in less than 1 ms 
[12:09:43]  webpack started ... 
[12:09:43]  copy finished in 3.42 s 
[12:09:55]  webpack finished in 11.83 s 
[12:09:55]  sass started ... 

Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.

[12:09:57]  sass finished in 2.10 s 
[12:09:57]  postprocess started ... 
[12:09:57]  postprocess finished in 9 ms 
[12:09:57]  lint started ... 
[12:09:57]  build dev finished in 17.38 s 

[...Remaining log output truncated for brevity...]

[12:10:53]  tslint: src/app/app.component.ts, line: 13 
            All imports on this line are unused. 

      L12:  import 'rxjs/add/operator/take';
      L13:  import { take } from 'rxjs/operators/take'

[12:10:53]  lint finished in 4.32 s 
  ionic:cli-utils:lib:hooks Looking for ionic:build:after npm script. +25s
> cordova build ios --verbose
No scripts found for hook "before_build".
[ERROR] An error occurred while running subprocess cordova.

        cordova build ios --verbose exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

My code works fine when I run ionic serve, but the issue arises during the ios build process. Any insights on what might be causing this error?

Answer №1

Follow these instructions to resolve the issue:

  1. Remove the iOS platform using the command ionic cordova platform rm ios
  2. Add the latest iOS platform version using the command ionic cordova platform add ios@latest
  3. Build the iOS platform using the command ionic cordova build ios

These steps should work without any problems. Give it a try and hopefully, it solves your issue. :)

Answer №2

Encountered an issue while using "cordova-ios": "^4.5.5". Resolved the problem by upgrading to "cordova-ios": "^5.1.1".

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to input a parameter into an https function when it is invoked from a Swift application?

Currently, integrating stripe into my app using typescript and I have the below function: exports.deleteStripeCustomer = functions.https.onCall((data, context) => { const deleted = await stripe.customers.del( "I need to add the customers ID ...

Using TypeScript: Defining function overloads with a choice of either a string or a custom object as argument

I'm attempting to implement function overloading in TypeScript. Below is the code snippet I have: /** * Returns a 400 Bad Request error. * * @returns A response with the 400 status code and a message. */ export function badRequest(): TypedRespons ...

Updating the parameters when clicking on each pagination button: A guide

Does anyone have advice on implementing pagination? I am currently working on loading a datatable with a few records initially. Once the page is loaded, I want to be able to click on pagination buttons like next or any pagination buttons to display a new s ...

Tips on integrating TypeScript into JavaScript

Currently, I am working with a node.js server.js file. var http = require('http'); var port = process.env.port || 1337; http.createServer(function (req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' }); res ...

Creating a declaration file for a library's entry point involves outlining the structure and types

I have developed an npm library that is made up of several ES6 modules, which are then consolidated into a single js file. The directory structure looks like this: src main.ts one.ts two.ts three.ts types index.d.ts index.ts The index.ts fil ...

Error in Typescript: Cannot assign type 'string[]' to type 'string'

I'm currently developing a project using Next.js with Typescript and .tsx files, and I'm utilizing Supabase as my database. While everything is functioning perfectly on localhost, I'm encountering an issue when trying to build the project o ...

Use PipeTransform to apply multiple filters simultaneously

Is it possible to apply multiple filters with PipeTransform? I attempted the following: posts; postss; transform(items: any[]): any[] { if (items && items.length) this.posts = items.filter(it => it.library = it.library ...

Angular 4 offers a variety of template options to choose from

Imagine these divs within a component: <div ngIf="condition1"> <button (click)="set_condition1_false_and_2_true()">show-template-2</button> </div> <div ngIf="condition2> <button (click)="set_condition2_false_and_3_ ...

How can I modify the appearance of folders in FileSystemProvider?

I have created an extension for vscode that includes a virtual filesystem with fake directories and files. While the extension is functioning properly, I am facing some challenges in customizing certain aspects due to lack of documentation. 1) I need to u ...

How can the panel within an accordion be enlarged or minimized?

Currently, I am implementing an accordion feature with the option to expand or collapse all panels using two buttons. My goal is to allow users to manage each panel within the accordion individually. However, I have encountered an issue that needs attenti ...

Using TypeScript to validate the API response against specific types

I'm intrigued by the scenario where you expect a specific data type as a response from fetch / Axios / etc, but receive a different type instead. Is there a way to identify this discrepancy? interface HttpResponse<T> extends Response { parsed ...

How to dynamically insert variables into a separate HTML file while creating a VS Code extension

Currently working on a vscode extension, I'm facing an issue with containing the html in a string (like this: https://github.com/microsoft/vscode-extension-samples/blob/main/webview-view-sample/src/extension.ts). It leads to a large file size and lack ...

The input argument must be of type 'PollModel', as the property 'pollId' is required and missing in the provided 'any[]' type

Hey there! An issue popped up when I tried to pass an empty array as a model in my Angular project. The error message reads: "Argument of type 'any[]' is not assignable to parameter of type 'PollModel'. Property 'pollId' is ...

Is it possible to utilize Ionic for creating a hosted web application without the need for node.js?

My curiosity lies in utilizing Ionic for constructing a web application. The layout, form elements, and integration with angular.js all appear to be well-designed. However, I have noticed that Ionic is mainly tailored towards developing native apps for An ...

The outcome of spawning Node.js is as follows: Python3 is unable to open the file './test' due to the error message [Errno 2] indicating that the file or directory does not exist

I am currently trying to execute a basic python script named test.py using the child process in Node JS, however I keep receiving an error message stating python3: can't open file './test': [Errno 2] No such file or directory. Despite my eff ...

Utilize the composite primary key of an Entity within Typeorm for efficient data retrieval

I am working with the following database entities: @Entity() class Team { @PrimaryGeneratedColumn() id: string @PrimaryColumn() teamName: string @OneToMany(() => Player, player => player.team) players: Player[] } @Entity() class Player ...

Ways to determine the number of duplicate items in an Array

I have an array of objects that contain part numbers, brand names, and supplier names. I need to find a concise and efficient way to determine the count of duplicate objects in the array. [ { partNum: 'ACDC1007', brandName: 'Electric&apo ...

Return the reference to an injected service class from the location where it was implemented

Is it feasible to return a reference from a component class with a custom interface implemented to the injected service class in my Angular 6 project? Here is an example of what I am aiming for. ServiceClass @Injectable() export class MyService { co ...

Tips on transforming current JSON into an alternate JSON format

Using React with TypeScript, I have a JSON data set of employees categorized by their department. Here's a snippet of the JSON data: [ { "department": 1, "name": "Test", "age": 32, "contact": 242222120, "id": 1 }, { "department": 1, "name": "Te ...

Ever tried asynchronous iteration with promises?

I have a specific code snippet that I am working on, which involves registering multiple socketio namespaces. Certain aspects of the functionality rely on database calls using sequelize, hence requiring the use of promises. In this scenario, I intend for t ...