Adding iOS platform


#1

Hello,
I am currently trying to deploy my project to iOS but i am hitting on a few issues.
Checking my package.json i dont have installed tns.ios dependencies.

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.FastCanteen"
  },
  "dependencies": {
    "@angular/animations": "~4.0.0",
    "@angular/common": "~4.0.0",
    "@angular/compiler": "~4.0.0",
    "@angular/core": "~4.0.0",
    "@angular/forms": "~4.0.0",
    "@angular/http": "~4.0.0",
    "@angular/platform-browser": "~4.0.0",
    "@angular/platform-browser-dynamic": "~4.0.0",
    "@angular/router": "~4.0.0",
    "nativescript-angular": "^3.0.0",
    "nativescript-bottombar": "^3.0.5",
    "nativescript-calendar": "^1.2.2",
    "nativescript-dom": "^2.0.0",
    "nativescript-fancy-calendar": "^3.0.0",
    "nativescript-orientation": "^1.6.1",
    "nativescript-radiobutton": "^0.1.0",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-unit-test-runner": "^0.3.4",
    "nativescript-zxing": "^1.5.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "5.0.0",
    "tns-core-modules": "^3.1.0",
    "tns-ios": "3.1.0",
    "zone.js": "0.8.2"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.6",
    "@types/mocha": "^2.2.41",
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "chai": "^4.1.0",
    "karma": "^1.7.0",
    "karma-chai": "^0.1.0",
    "karma-mocha": "^1.3.0",
    "karma-nativescript-launcher": "^0.4.0",
    "lazy": "1.0.11",
    "mocha": "^3.4.2",
    "nativescript-dev-typescript": "^0.4.0",
    "typescript": "~2.2.1"
  }
}

When i try to run the following command:

tns platform add ios --log trace

to add the ios platform it gives me the following error:

MacBook-Pro-de-mcare:FastCanteen mcarevodafone$ tns platform add ios --log trace
Loading extensions.
execFile: /usr/local/opt/android-sdk/platform-tools/adb "help"
Error while executing '/usr/local/opt/android-sdk/platform-tools/adb help'. Error is: spawn /usr/local/opt/android-sdk/platform-tools/adb ENOENT
Exec uname -a 
 stdout: Darwin MacBook-Pro-de-mcare.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
 
 stderr: 
Exec npm -v 
 stdout: 5.3.0
 
 stderr: 
spawn: java "-version"
Exec node-gyp -v 
 stdout:  
 stderr: /bin/sh: node-gyp: command not found

Exec xcodebuild -version 
 stdout: Xcode 8.2.1
Build version 8C1002
 
 stderr: 
Exec gem which xcodeproj 
 stdout: /Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.5.1/lib/xcodeproj.rb
 
 stderr: 
Exec pod --version 
 stdout: 1.3.1
 
 stderr: 
Exec null version 
 stdout:  
 stderr: /bin/sh: null: command not found

spawn: /usr/local/opt/android-sdk/tools/emulator "-help"
The result of checking is Android Emulator installed is:
- stdout: 
- stderr: spawn /usr/local/opt/android-sdk/tools/emulator ENOENT
Exec mono --version 
 stdout: Mono JIT compiler version 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45 Wed Jul 27 16:20:13 EDT 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.6.0svn-mono-master/a173357)
	GC:            sgen
 
 stderr: 
Exec git --version 
 stdout: git version 2.10.1 (Apple Git-78)
 
 stderr: 
Exec gradle -v 
 stdout:  
 stderr: /bin/sh: gradle: command not found

Exec "/Library/Java/Home/bin/javac" -version 
 stdout:  
 stderr: javac 1.8.0_144

System information:
{ procInfo: 'nativescript/3.1.3',
  platform: 'darwin',
  os: 'Darwin MacBook-Pro-de-mcare.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64\n',
  shell: '/bin/bash',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v6.11.2',
  npmVer: '5.3.0',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: 'Xcode 8.2.1\nBuild version 8C1002\n',
  xcodeprojGemLocation: '/Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.5.1/lib/xcodeproj.rb\n',
  itunesInstalled: true,
  cocoapodVer: '1.3.1',
  adbVer: null,
  emulatorInstalled: false,
  monoVer: '4.4.2',
  gitVer: '2.10.1 (Apple Git-78)',
  gradleVer: null,
  javacVersion: '1.8.0_144' }
Looking for project in '/Users/mcarevodafone/Desktop/FastCanteen'
Project directory is '/Users/mcarevodafone/Desktop/FastCanteen'.
Exec which xcodebuild 
 stdout: /usr/bin/xcodebuild
 
 stderr: 
Exec xcodebuild -version | head -n 1 | sed -e 's/Xcode //' 
 stdout: 8.2.1
 
 stderr: 
Initializing analytics statuses.
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'platform|add'.
Creating NativeScript project for the ios platform
Path: /Users/mcarevodafone/Desktop/FastCanteen/platforms/ios
Package: org.nativescript.FastCanteen
Name: FastCanteen
Copying template files...
  ◞ Installing tns-iosExec npm view tns-ios  dist-tags --json 
 stdout: {
  "latest": "3.1.0",
  "next": "3.2.0-2017-7-28-1",
  "rc": "3.1.0"
}
 
 stderr: 
Using version 3.1.0. 
  ◝ Installing tns-iosExec npm view tns-ios  versions --json 
 stdout: [
  "0.1.0",
  "0.1.1",
  "0.1.2",
  "0.1.3",
  "0.1.4",
  "0.1.5",
  "0.1.6",
  "0.1.7",
  "0.1.8",
  "0.1.9",
  "0.1.10",
  "0.1.11",
  "0.2.0",
  "0.3.0",
  "0.3.1",
  "0.4.0",
  "0.4.2",
  "0.9.1",
  "0.9.2-exp-ios-8.2",
  "0.10.0",
  "1.0.0",
  "1.0.1",
  "1.1.0",
  "1.1.1",
  "1.1.2",
  "1.2.0",
  "1.2.1",
  "1.2.2",
  "1.3.0",
  "1.4.0",
  "1.4.1",
  "1.5.0",
  "1.5.1",
  "1.5.2",
  "1.6.0",
  "1.7.0",
  "2.0.0",
  "2.0.1",
  "2.1.0",
  "2.1.1",
  "2.2.0",
  "2.2.1",
  "2.3.0",
  "2.4.0-2016.9.16.4",
  "2.4.0-2016-10-11-5",
  "2.4.0-2016-10-18-1",
  "2.4.0-2016-10-19-2",
  "2.4.0-2016-10-19-3",
  "2.4.0-2016-9-17-1",
  "2.4.0-2016-9-26-1",
  "2.4.0-2016-9-26-2",
  "2.4.0-2016-9-26-4",
  "2.4.0-2016-9-27-1",
  "2.4.0-2016-9-28-1",
  "2.4.0",
  "2.5.0-2016-10-20-1",
  "2.5.0-2016-10-21-1",
  "2.5.0-2016-10-27-2",
  "2.5.0-2016-10-27-3",
  "2.5.0-2016-10-31-1",
  "2.5.0-2016-11-1-1",
  "2.5.0-2016-11-15-1",
  "2.5.0-2016-11-17-1",
  "2.5.0-2016-11-22-1",
  "2.5.0-2016-11-25-1",
  "2.5.0-2016-11-3-1",
  "2.5.0-2016-11-3-2",
  "2.5.0-2016-12-20-1",
  "2.5.0-2016-12-21-1",
  "2.5.0-2016-12-7-2",
  "2.5.0-2017-1-4-1",
  "2.5.0-2017-1-4-2",
  "2.5.0",
  "2.5.1",
  "2.6.0-2017-1-10-1",
  "2.6.0-2017-1-17-1",
  "2.6.0-2017-2-2-1",
  "2.6.0-2017-2-6-1",
  "2.6.0-2017-3-10-1",
  "3.0.0-2017-3-14-1",
  "3.0.0-2017-4-10-1",
  "3.0.0-2017-4-10-2",
  "3.0.0-2017-4-18-1",
  "3.0.0-2017-4-18-2",
  "3.0.0-2017-4-20-1",
  "3.0.0-2017-4-3-1",
  "3.0.0-2017-4-3-2",
  "3.0.0-2017-4-4-1",
  "3.0.0-rc.1",
  "3.0.0-rc.2",
  "3.0.0-rc.1-2017-3-28-1",
  "3.0.0-rc.1-2017-3-28-2",
  "3.0.0",
  "3.0.1",
  "3.1.0-2017-4-26-1",
  "3.1.0-2017-5-10-1",
  "3.1.0-2017-5-15-1",
  "3.1.0-2017-5-16-1",
  "3.1.0-2017-5-16-2",
  "3.1.0",
  "3.2.0-2017-6-20-2",
  "3.2.0-2017-6-28-1",
  "3.2.0-2017-6-30-1",
  "3.2.0-2017-6-30-2",
  "3.2.0-2017-7-27-1",
  "3.2.0-2017-7-28-1",
  "3.2.0-2017-7-5-2",
  "3.2.0-2017-7-5-5"
]
 
 stderr: 
Installing  tns-ios
spawn: npm "install" "tns-ios@3.1.0" "--silent" "--save-exact" "--save"
  ◝ Installing tns-ios⸨       ░░░░░░░░░░░⸩ ⠴ extract:tns-ios: verb lock using /Users/mcarevodafone/.npm/_locks/staging-a0a4e0184ebcc110.lock for /Users/mcarevoda  ◡ Installing tns-ios⸨        ░░░░░░░░░░⸩ ⠹ extract:indexof: sill extract set-immediate-shim@https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-  ◜ Installing tns-ios⸨         ░░░░░░░░░⸩ ⠼ extract:is-equal-shallow: sill extract normalize-path@https://registry.npmjs.org/normalize-path/-/normalize-path-2.1Error: Command npm install tns-ios@3.1.0 --silent --save-exact --save failed with exit code 1
    at ChildProcess.childProcess.on (/usr/local/lib/node_modules/nativescript/lib/node-package-manager.js:234:36)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:891:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Error: Command npm install tns-ios@3.1.0 --silent --save-exact --save failed with exit code 1
    at ChildProcess.childProcess.on (/usr/local/lib/node_modules/nativescript/lib/node-package-manager.js:234:36)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:891:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'help'.
List of registered commands: /?, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, clean-app, clean-app|android, clean-app|ios, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, devices, devices|android, devices|ios, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, error-reporting, extension, extension|install, extension|uninstall, help, info, init, install, platform, platform|*list, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|install, plugin|remove, plugin|update, post-install-cli, prepare, proxy, proxy|clear, proxy|set, publish, publish|ios, run, run|android, run|ios, test, test|android, test|init, test|ios, update, usage-reporting
Reading help for command 'platform|add'. FileName is 'platform-add.md'.
# platform add

┌───────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Usage                 │ Synopsis                                                                                                                         │
│ Android latest        │ $ tns platform add android [--framework-path <File Path>] [--symlink] [--sdk <API Level>] [--platform-template <Platform         │
│ runtime               │ Template>]                                                                                                                       │
│ Android selected      │ $ tns platform add android[@<Version>] [--framework-path <File Path>] [--symlink] [--sdk <API Level>] [--platform-template       │
│ runtime               │ <Platform Template>]                                                                                                             │
│ iOS latest runtime    │ $ tns platform add ios [--framework-path <File Path>] [--symlink]                                                                │
│ iOS selected runtime  │ $ tns platform add ios[@<Version>] [--framework-path <File Path>] [--symlink] [--platform-template <Platform Template>]          │
└───────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Configures the current project to target the selected platform. 

### Options

    * --framework-path - Sets the path to a NativeScript runtime for the specified platform that you want to use instead of the default runtime. If --symlink is specified, <File Path> must point to directory in which the runtime is already extracted. If --symlink is not specified, <File Path> must point to a valid npm package.
    * --symlink - Creates a symlink to a NativeScript runtime for the specified platform that you want to use instead of the default runtime. If --frameworkPath is specified, creates a symlink to the specified directory. If --frameworkPath is not specified, creates a symlink to platform runtime installed with your current version of NativeScript.
    * --sdk - Sets the target Android SDK for the project.
    * --platform-template - Sets the platform template that will be used for the native application.

### Attributes

    * <API Level> is a valid Android API level. For example: 17, 19, MNC.
    * <File Path> is the complete path to a valid npm package or a directory that contains a NativeScript runtime for the selected platform.
    * <Platform Template> is a valid npm package, path to directory, .tgz or GitHub URL that contains a native Android or iOS template.
    * <Version> is any available version of the respective platform runtime published in npm. 

Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }

I also can’t build the project. But it doesnt make sense building the project if i dont have a platform for it to run.
I also tried running again and it gave this error output:


MacBook-Pro-de-mcare:FastCanteen mcarevodafone$ tns platform add ios
Copying template files...
  ◜ Installing tns-iosInstalling  tns-ios
  ◝ Installing tns-ios⸨       ░░░░░░░░░░░⸩ ⠏ extract:zone.js: verb lock using 
  ◞ Installing tns-ios⸨            ░░░░░░⸩ ⠸ install:nan: info lifecycle nan@https://registry.npmjs.org/nan/-/nan-2.6.2.tgz~install: nan@https://registry.npmjs.o  ◝ Installing tns-ios[fsevents] Success: "/Users/mcarevodafone/Desktop/FastCanteen/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
  ◜ Installing tns-iosCached binary found at /Users/mcarevodafone/.npm/node-sass/4.5.3/darwin-x64-48_binding.node
  ◡ Installing tns-iosBinary found at /Users/mcarevodafone/Desktop/FastCanteen/node_modules/node-sass/vendor/darwin-x64-48/binding.node
Testing binary
Binary is fine
  ◜ Installing tns-iosProject already targets TypeScript ~2.2.1
+ tns-ios@3.1.0
added 1567 packages in 79.751s
cp: no such file or directory: /Users/mcarevodafone/Desktop/FastCanteen/node_modules/arr-flatten/framework/*
# platform add

Any ideas?

Basically the first error message is regarding this:

Error: Command npm install tns-ios@3.1.0 --silent --save-exact --save failed with exit code 1

And the second error message is related to this:

cp: no such file or directory: /Users/mcarevodafone/Desktop/FastCanteen/node_modules/arr-flatten/framework/*

#2

More information:

I also try to upgrade my npm version and i get this error which i can’t understand…

32

Uninstalled npm and node and reinstalled them didn’t work.
Created a new project and copied all the information to the new project and rebuilded and it worked.