problem while trying to upload expo app to app store

I am trying to upload my expo app to the app store (ios).
While running the command $expo upload:ios I get this error:

[15:27:31]: Ready to upload new build to TestFlight (App: 1478118518)…

[15:27:32]: undefined method `split’ for nil:NilClass

Failed to upload the standalone app to the app store.

Unexpected token x in JSON at position 0

SyntaxError: Unexpected token x in JSON at position 0

at JSON.parse (<anonymous>)

at runFastlaneAsync (/expo-cli@3.0.10/src/commands/upload/utils.js:46:20)

at process._tickCallback (internal/process/next_tick.js:68:7)

Do you have any idea how to solve it?

Thanks!

undefined method `split’ for nil:NilClass looks like a Ruby error. It seems something was expected to be a string, but was instead nil.

The Unexpected token... JSON error after that looks like it’s caused by the Ruby error (I think).

The JSON error is coming from some code to parse the output of the pilot_upload command, which is written in Ruby. (So it seems we’re on the right track :slight_smile:)

I tried following it further than that, but ran out of time. It would be easier to track down what’s happening if we can get a stack trace out of pilot_upload.

I’m also having this issue. @wodin, did you get any further with finding out what the issue is?

Hi @harryleeming.

I’ve waded though a bit more of this now.

The JSON parse error is coming from here. That’s happening because stderr is not JSON. I suspect it’s a Ruby stack trace.

Maybe try editing utils.js to add a console.error(stderr) call before the JSON.parse(stderr) call.

Quick’n’dirty method: Find utils.js in the file hierarchy created when you installed expo-cli (e.g. on the machine I’m typing this on it’s at /usr/local/node/lib/node_modules/expo-cli/build/commands/upload/utils.js) and edit it to call console.error(stderr) just before the JSON.parse(stderr) line. Then try to upload again and see if you get more details about where the undefined method `split’ for nil:NilClass is happening. Make a backup of utils.js before editing it, of course, but at worst you can uninstall and reinstall expo-cli.

Cleaner method: Clone the expo-cli repository, then set the repository up for development. After yarn start prints something like expo-cli: [0] 17:57:55 - Found 0 errors. Watching for file changes. you should find an expo symlink at node_modules/.bin/expo.

If you now edit packages/expo-cli/src/commands/upload/utils.js to add the console.error(stderr) call you should see something like this in the terminal:

18:02:47 - File change detected. Starting incremental compilation...
expo-cli: [0] 
expo-cli: [1] [18:02:47] Starting 'babel'...
expo-cli: [0] 
expo-cli: [0] 18:02:49 - Found 0 errors. Watching for file changes.
expo-cli: [1] [18:02:49] Finished 'babel' after 1.84 s

If you put the node_modules/.bin directory first in your PATH then your modified expo-cli will run instead of the globally installed one when you run expo upload:ios.

e.g.:

$ export PATH=$(pwd)/node_modules/.bin:$PATH
$ which expo
/home/michael/work/expo-cli/node_modules/.bin/expo

Try one of the two methods above and I hope you’ll get a stack trace that you can paste here.

Post it like this:

```
stack
trace
here
```

So it turns out I had deleted some xcode files that I thought were taking up unneccessary space. So I just deleted and reinstalled xcode and that fixed the problem :slight_smile:

1 Like