Version strings are not in the same format


#1

I just have installed Nativescript on my macOS Sierra 10.12.12.
But when i enter the command: tns platfrom add ios I get the following error message:

Version strings are not in the same format
#platform add

When I enter the same command for Android everything works fine.

tns doctor gives me the following feedback:

Your components are up-to-date.
No issues were detected.

I hope somebody can help me, the tns version is 2.5.2

Thank you in advance!


#2

Normally I create a new project, and then run tns run ios to get started. Can you try that and see what happens?


#3

Hello Jen,

Everything works ok when I create an app, I have created the HelloWorld app. The problem occurs when I try to add a iOS platform.

Version strings are not in the same format
#platform add

I really can not find out what the problem is, because when I add a Android platform everything works as it should.

Did I forget something?


#4

i have the same problem!


#5

Hope we can solve this, this is my second day trying to fix this. Want to get started with NativeScript :slight_smile:

tns platform add ios --log trace > log.txt
Error: Version strings are not in the same format
at Object.versionCompare (/usr/local/lib/node_modules/nativescript/lib/common/helpers.js:111:15)
at /usr/local/lib/node_modules/nativescript/lib/services/ios-project-service.js:92:25
at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:69:47
at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
at _.each.platform (/usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:55:58)
at arrayEach (/usr/local/lib/node_modules/nativescript/node_modules/lodash/lodash.js:451:11)
at Function.forEach (/usr/local/lib/node_modules/nativescript/node_modules/lodash/lodash.js:8634:14)


#6

i use mac.

           which head

should give
/usr/bin/head

there may be a problem if it returns something like
/Applications/XAMPP/bin/head

it is because they are different utilities!


#7
which head

Gives me: /usr/bin/head


#8

xcodebuild -version | head -n 1 | sed -e ‘s/Xcode //’

Gives me:
8.0


#9

Gives me: 8.2.1

Really frustrating


#10

I don’t know whether need the steps discussed in https://github.com/NativeScript/nativescript-cli/issues/2509 or not!


#11

i will put

console.log(version1);
console.log(version2);

in function versionCompare() of helpers.js
and see why the version formats are different!


#12

@jolee have you tried to compare version 1 and version 2?


#13

Ok, i have been debugging and found a “solution”. Not the best solution but everything works now!

I have edited the following file: /usr/local/lib/node_modules/nativescript/lib/services/ios-project-service.js

When I comment out the code on line 91 till line 94 everything works perfect! What is being compared here and how to fix this?

let xcodeBuildVersion = this.getXcodeVersion(); if (helpers.versionCompare(xcodeBuildVersion, IOSProjectService.XCODEBUILD_MIN_VERSION) < 0) { this.$errors.fail("NativeScript can only run in Xcode version %s or greater", IOSProjectService.XCODEBUILD_MIN_VERSION); }


#14

in my case , they are

version1: 8.0
version2: 6.0


#15

getXcodeVersion() convert format x.y.z to x.y
then, compare version1 with the required min version 6.0

so i think the problem should be version1 is not in the valid format x.y


#16

Did you find a fix ?

Thanks!


#17

i just rename the head utility in XAMPP to xhead. and, everything work fine!

ref: http://unix.stackexchange.com/questions/276601/is-it-possible-to-add-a-single-executable-rather-than-an-entire-directory-to-m


#18

Hey jolee, can you share snippet how did you changed this?


#19

ok, I just renamed head utility to xhead, and didn’t changed anything else… apache is working and can add platform


#20

In terminal, I type:

mv /Applications/XAMPP/bin/HEAD /Applications/XAMPP/bin/xhead

I just do this only and everything work fine!