question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Release Build bundle step fails with SyntaxError unexpected token in joi

See original GitHub issue

The release build fails with:

+ node /Users/johnk/dev/play/AwesomeProject/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/johnk/Library/Developer/Xcode/DerivedData/AwesomeProject-fosllkxhaydisjhbhqsdkxjddemd/Build/Intermediates.noindex/ArchiveIntermediates/AwesomeProject/BuildProductsPath/Release-iphoneos/AwesomeProject.app/main.jsbundle --assets-dest /Users/johnk/Library/Developer/Xcode/DerivedData/AwesomeProject-fosllkxhaydisjhbhqsdkxjddemd/Build/Intermediates.noindex/ArchiveIntermediates/AwesomeProject/BuildProductsPath/Release-iphoneos/AwesomeProject.app
/Users/johnk/dev/play/AwesomeProject/node_modules/@hapi/joi/lib/types/object/index.js:255
                        !pattern.schema._validate(key, state, { ...options, abortEarly:true }).errors) {
                                                                ^^^
SyntaxError: Unexpected token ...
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    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)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/johnk/dev/play/AwesomeProject/node_modules/@hapi/joi/lib/types/func/index.js:5:20)

+ [[ false != true ]]
+ [[ ! -f /Users/johnk/Library/Developer/Xcode/DerivedData/AwesomeProject-fosllkxhaydisjhbhqsdkxjddemd/Build/Intermediates.noindex/ArchiveIntermediates/AwesomeProject/BuildProductsPath/Release-iphoneos/AwesomeProject.app/main.jsbundle ]]
+ echo 'error: File /Users/johnk/Library/Developer/Xcode/DerivedData/AwesomeProject-fosllkxhaydisjhbhqsdkxjddemd/Build/Intermediates.noindex/ArchiveIntermediates/AwesomeProject/BuildProductsPath/Release-iphoneos/AwesomeProject.app/main.jsbundle does not exist. This must be a bug with'
File /Users/johnk/Library/Developer/Xcode/DerivedData/AwesomeProject-fosllkxhaydisjhbhqsdkxjddemd/Build/Intermediates.noindex/ArchiveIntermediates/AwesomeProject/BuildProductsPath/Release-iphoneos/AwesomeProject.app/main.jsbundle does not exist. This must be a bug with
+ echo 'React Native, please report it here: https://github.com/facebook/react-native/issues'
React Native, please report it here: https://github.com/facebook/react-native/issues

React Native version: System: OS: macOS 10.15.2 CPU: (8) x64 Intel® Core™ i7-3740QM CPU @ 2.70GHz Memory: 1.42 GB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 12.14.1 - /usr/local/bin/node Yarn: 1.21.1 - ~/dev/clypsy/client/mobile/clypsy/node_modules/.bin/yarn npm: 6.13.4 - /usr/local/bin/npm Watchman: 4.3.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 Android SDK: API Levels: 19, 22, 23, 24, 25, 26, 27, 28 Build Tools: 19.1.0, 20.0.0, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3 System Images: a…gle_apis | Google APIs Intel x86 Atom_64 …, a…gle_apis | Google APIs Intel x86 Atom_64 …, a…gle_apis | Google APIs Intel x86 Atom_64 … IDEs: Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5

Steps To Reproduce

  1. npx react-native init AwesomeProject
  2. open AwesomeProject in Xcode
  3. configure signing
  4. Select Product–>Archive

Describe what you expected to happen:

Project to build and generate an archive

Describe what happened:

Project builds successfully but then the react bundle fails with error noted above. NOTE: if I run the node bundle command manually on the command line it succeeds

Things tried:

I’ve tried deleting node_modules, clearing watchman cache and deleting DerivedData

Research seems to suggest that there is a bug in @hapi/joi version 15.0.1 and greater See: https://github.com/hapijs/joi/issues/1802

This project IS able to be built and run in debug mode.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
lucasmrdtcommented, Mar 3, 2020

Hi ! I’ve got the error and solved it easily :

rm -rf $HOME/.nvm/versions/node/* # remove all other versions of node
nvm install node # download the latest version of node

If you don’t have nvm, follow these steps here.

For my project, RN uses an expired version of node using nvm (v7.7.2). This version doesn’t handle the “spread operator”. By removing it and installing the latest version of node (still using nvm), RN uses the good version and then the error gone.

I hope it’ll fix yours.

0reactions
johnckendallcommented, May 29, 2020

🤔👍🏽

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create-React-App build - "Uncaught SyntaxError: Unexpected ...
When I deploy without changing any default settings, I will get this "Uncaught SyntaxError: Unexpected token <" error and nothing shows up ...
Read more >
syntaxerror unexpected token 'export' - You.com | The search engine ...
It appears to me that there is an issue in the package you're using. It's trying to use ES modules syntax (import /...
Read more >
How to Fix SyntaxError: Unexpected token < in JSON at ...
Usually this error is caused when your server returns HTML (which typically begins with <DOCTYPE html> or <html> ) instead of JSON. Valid...
Read more >
How to Fix the "Parse Error: Syntax Error, Unexpected" in ...
3) syntax error, unexpected variable; 4) syntax error, unexpected identifier. The error message will usually identify the specific token, ...
Read more >
Sitecore jss 20.0.3 install error: Unexpected token '.'
0), all I am doing is trying to install a test Sitecore jss app. But the first step itself is giving me this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found