Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Build bundle step fails with SyntaxError unexpected token in joi #27860

Closed
johnckendall opened this issue Jan 24, 2020 · 8 comments
Closed
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.

Comments

@johnckendall
Copy link

johnckendall commented Jan 24, 2020

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(R) Core(TM) 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: hapijs/joi#1802

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

@react-native-bot react-native-bot added the Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. label Jan 24, 2020
@hramos hramos added Needs: Triage 🔍 and removed Bug Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. labels Feb 1, 2020
@dulmandakh
Copy link
Contributor

Is it working just fine in dev mode?

@johnckendall
Copy link
Author

Yes, it builds and runs fine in dev mode on the simulator

@lucasmrdt
Copy link

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.

@chrisglein
Copy link

Sounds like this may have been addressed by cleaning up node versions. If that's not the case reactivate or open a new issue on latest.

@azuxx
Copy link

azuxx commented May 8, 2020

@chrisglein Hello, I updated node to latest version but it did not worked for me. Still have the spread operator error. Yesterday I opened a new issue here #28848 which is actually the same of this one.

Do you have any suggestions about how to fix this issue? 🙏🏻

@johnckendall
Copy link
Author

Just tried this again with Node 12.14.1 and it worked

@azuxx
Copy link

azuxx commented May 29, 2020

Just tried this again with Node 12.14.1 and it worked

@johnckendall at the end the problem was that Pods were broken somehow. I removed Pods folder, did the setup and install, and build completed successfully🤷🏻‍♂️

@johnckendall
Copy link
Author

🤔👍🏽

@facebook facebook locked as resolved and limited conversation to collaborators Oct 1, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants