New laptop - ionic build ios failure


#1

Hi there,

I’m having some issues with my project trying to build/emulate ios.

Please find below my errors and setup

******************************************************
 Dependency warning - for the CLI to run correctly,
 it is highly recommended to install/upgrade the following:

 Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`
 Install ios-sim to deploy iOS applications.`npm install -g ios-sim` (may require sudo)
 Install ios-deploy to deploy iOS applications to devices.  `npm install -g ios-deploy` (may require sudo)

******************************************************

> ionic-hello-world@ ionic:build /Users/usrname/Projects/projectname/projectname
> ionic-app-scripts build

[20:32:52]  ionic-app-scripts 1.1.3
[20:32:52]  build dev started ...
[20:32:52]  clean started ...
[20:32:52]  clean finished in 3 ms
[20:32:52]  copy started ...
[20:32:52]  transpile started ...
[20:32:55]  transpile finished in 2.84 s
[20:32:55]  preprocess started ...
[20:32:55]  preprocess finished in 1 ms
[20:32:55]  webpack started ...
[20:32:55]  copy finished in 2.96 s
[20:33:03]  webpack finished in 7.98 s
[20:33:03]  sass started ...
[20:33:04]  sass finished in 835 ms
[20:33:04]  postprocess started ...
[20:33:04]  postprocess finished in 1 ms
[20:33:04]  lint started ...
[20:33:04]  build dev finished in 11.68 s
[20:33:06]  tslint: src/pages/complete-profile/complete-profile.ts, line: 104
            Unused variable: 'userStatus'

     L103:  //Create new user data fname, lname, email, profilePhoto, description, if leader registered set user status to 2, otherwise set to 1.
     L104:  var userStatus;
     L105:  this.angularfire.database.object('/users/' + firebase.auth().currentUser.uid).set({

[20:33:06]  tslint: src/pages/pending-notice/pending-notice.ts, line: 7
[20:33:06]  tslint: src/pages/home/home.ts, line: 12
[20:33:06]  tslint: src/providers/login.ts, line: 12
[20:33:06]  tslint: src/pages/booking/booking.ts, line: 13
            Unused import: 'WalkthroughPage'

       L6:  import { HomePage } from '../home/home';
       L7:  import { WalkthroughPage } from '../walkthrough/walkthrough';
       L8:  import * as firebase from 'firebase';

            Unused import: 'Observable'

      L11:  import { Storage } from '@ionic/storage';
      L12:  import { Observable } from 'rxjs/Rx';
      L13:  import 'rxjs/add/operator/take';

            Unused import: 'Observable'

      L11:  import { Storage } from '@ionic/storage';
      L12:  import { Observable } from 'rxjs/Rx';
      L13:  import 'rxjs/add/operator/take';

            Unused import: 'Observable'

      L12:  import { ToastProvider } from '../../providers/toast';
      L13:  import { Observable } from 'rxjs/Rx';
      L14:  import 'rxjs/add/operator/take';

[20:33:06]  lint finished in 2.05 s

You have been opted out of telemetry. To change this, run: cordova telemetry on.

 Using this version of Cordova with older version of cordova-ios is being deprecated. Consider upgrading to cordova-ios@4.0.0 or newer.


Running command: /Users/usrname/Projects/projectname/projectname/platforms/ios/cordova/build

module.js:472
    throw err;
    ^

Error: Cannot find module 'unorm'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/usrname/Projects/projectname/projectname/platforms/ios/cordova/Api.js:24:13)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

Error: /Users/usrname/Projects/projectname/projectname/platforms/ios/cordova/build: Command failed with exit code 1

Ionic Framework Version: 2.1.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.1.3
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v7.9.0
Xcode version: Not installed


#2

Did you install Cordova?
Did you npm i in our project directory?


#3

Yep, this is installed.

I noticed that my iOS stuff was not configured correctly so I have now enabled ios xcode for my terminal. So updated ionic info

Ionic Framework Version: 2.1.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.1.3
ios-deploy version: Not installed
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v7.9.0
Xcode version: Xcode 8.3.1 Build version 8E1000a


#4

I’m still getting the same error and it’s coming from

You have been opted out of telemetry. To change this, run: cordova telemetry on.

Using this version of Cordova with older version of cordova-ios is being deprecated. Consider upgrading to cordova-ios@4.0.0 or newer.

Running command: /Users/usrname/Projects/projectname/projectname/platforms/ios/cordova/build

module.js:472
throw err;
^

Error: Cannot find module 'unorm’
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/Users/usrname/Projects/projectname/projectname/platforms/ios/cordova/Api.js:24:13)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)

Error: /Users/usrname/Projects/projectname/projectname/platforms/ios/cordova/build: Command failed with exit code 1

Any ideas?


#5

Which version of cordova-ios are you on? Should be at ionic platform list.


#6

Installed platforms:
android 6.1.0
ios 4.3.1
Available platforms:
amazon-fireos ~3.6.3 (deprecated)
blackberry10 ~3.8.0
browser ~4.1.0
firefoxos ~3.6.3
osx ~4.0.1
webos ~3.7.0


#7

Sorry to bump this, but I can’t get it to work at all. This means that I can’t run the app with cordova plugins…


#8

Try it with the command cordova telemetry on
It sounds strange, but I also had problems under windows when I don’t use this command first.


#9

Just enabled the command as you mentioned, but still same error. :frowning:

Just thinking out loud here, but because I have a fresh new laptop and have I’ve not been able to run

ionic emulate ios

since I’ve had this fresh install. Do you think I’m missing something glaringly obvious?


#10

Going to go ahead and bump this again. Sorry if not allowed…


#11

I am out of ideas.

  • unorm is on npm https://www.npmjs.com/package/unorm, so you could install it globally - but this is not really useful.
  • Have you tried adding --verbose to the command and running it? Maybe it gives something useful.
  • Uninstall everything (Ionic, Cordova, npm, node.js) and reinstall (maybe using nvm for node as it is more flexible) by following the docs of Ionic to the dot.

#12

I managed to eventually get this to work. All I had to do was update to the latest version of Cordova iOS platform.

ionic platform rm ios
ionic platform add ios


#13

Well, isn’t ios 4.3.1 the current cordova-ios?


#14

Yes I think so, but this seemed to fix my configuration!


#15

That’s great, so something was broken with your /platform/ios folder and its content. Strange one, but awesome you fixed it and let us know.

Good luck developing your app!


#16

Yep seems so! Thanks for your patience and help though!