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

JSON::ParserError - 419: unexpected token #3305

Closed
1 of 9 tasks
mks11 opened this issue Mar 14, 2020 · 15 comments
Closed
1 of 9 tasks

JSON::ParserError - 419: unexpected token #3305

mks11 opened this issue Mar 14, 2020 · 15 comments
Labels
resolution: user Issue with users code or an issue that should be directed to Stack Overflow or the Discord server.

Comments

@mks11
Copy link

mks11 commented Mar 14, 2020

Issue

Describe your issue here

Pod install seems to work fine until I install the firestore package and run pod install afterwards. ( details below are from a bare-bone project that gives this error, I am getting the same error in the main project)

yarn add @react-native-firebase/firestore

While running cd ios && pod install

I get this error

JSON::ParserError - 419: unexpected token at '"src/core/lib/surface/validate'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/json/common.rb:156:in `parse'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/json/common.rb:156:in `parse'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification.rb:742:in `from_string'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification.rb:716:in `from_file'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/source.rb:186:in `specification'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver/lazy_specification.rb:37:in `specification'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/delegate.rb:340:in `block in delegating_block'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/delegate.rb:341:in `block in delegating_block'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:178:in `dependencies_for'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:18:in `block in dependencies_for'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in `with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:17:in `dependencies_for'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:807:in `block in group_possibilities'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:806:in `reverse_each'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:806:in `group_possibilities'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:778:in `possibilities_for_requirement'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:761:in `push_state_for_requirements'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:746:in `require_nested_dependencies_for'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:729:in `activate_new_spec'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:686:in `attempt_to_activate'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer/analyzer.rb:1065:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer/analyzer.rb:1063:in `resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.


Project Files

Javascript

Click To Expand

package.json:

{
"name": "FirestorInstall",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@react-native-firebase/app": "^6.3.4",
"@react-native-firebase/auth": "^6.3.4",
"@react-native-firebase/firestore": "^6.3.4",
"react": "16.9.0",
"react-native": "0.61.5"
},
"devDependencies": {
"@babel/core": "^7.8.7",
"@babel/runtime": "^7.8.7",
"@react-native-community/eslint-config": "^0.0.7",
"babel-jest": "^25.1.0",
"eslint": "^6.8.0",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.58.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'FirestorInstall' do

Pods for FirestorInstall

pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

target 'FirestorInstallTests' do
inherit! :search_paths
# Pods for testing
end

use_native_modules!
end

target 'FirestorInstall-tvOS' do

Pods for FirestorInstall-tvOS

target 'FirestorInstall-tvOSTests' do
inherit! :search_paths
# Pods for testing
end

end

# N/A

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 190.48 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 13.9.0 - ~/.nvm/versions/node/v13.9.0/bin/node
    Yarn: 1.16.0 - ~/.yarn/bin/yarn
    npm: 6.13.7 - ~/.nvm/versions/node/v13.9.0/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 23, 26, 28
      Build Tools: 23.0.1, 23.0.2, 26.0.2, 27.0.3, 28.0.0, 28.0.3
      System Images: android-23 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5977832
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • [x ] iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • 6.3.4
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION
      N


Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]

@mikehardy
Copy link
Collaborator

There are so many ways for things to wrong, I typically request people clone this repo and run the script for their versions (https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh for you) and see what things should look like. The problem is in the difference between what you have and what runs based on that script

@mks11
Copy link
Author

mks11 commented Mar 15, 2020

Thanks Mike. I ran the make-demo-v6.sh .

After that I cd ios && pod install. Everything seems fine.

Next, I add yarn add @react-native-firebase/firestore

runpod install again.

And I get the similar errors as posted above.

@mikehardy
Copy link
Collaborator

In the template you indicate you are using 5.4.3. Why do you run the v6 script?
Either way, firestore is already added
https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh#L100
https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh#L62

@mks11
Copy link
Author

mks11 commented Mar 15, 2020

Sorry, I let e.g. 5.4.3 stay in the template. The package.json have it correct

"@react-native-firebase/app": "^6.3.4",
"@react-native-firebase/auth": "^6.3.4",
"@react-native-firebase/firestore": "^6.3.4",
"react": "16.9.0",

In my project firestore wasn't installed. Following the documentation that says yarn add @react-native-firebase/firestore I am getting the errors after pod install.

I also tried to remove firestore yarn remove @react-native-firebase/firestore, and add it again.

@mikehardy
Copy link
Collaborator

My example adds firestore, and works fine. I can't reproduce.

@russellwheatley russellwheatley added the resolution: user Issue with users code or an issue that should be directed to Stack Overflow or the Discord server. label Mar 16, 2020
@mks11
Copy link
Author

mks11 commented Mar 18, 2020

I am having the same error even through the script. I am assuming it's coming at the same point when pod install is run for firestore. Please let me know if there is a better way to describe my problem.

@mikehardy
Copy link
Collaborator

Perhaps cocoapods 1.9 requires a higher ruby? I'm using ruby 2.7.0 (specifically 'ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]' managed by rvm)

I can't think of anything else though, although after running my script firestore should already be there, yarn adding it again doesn't seem right? But also shouldn't actually harm, and pod install should work. Definitely use the react-native-clean-project module at least once to see if it blows out something corrupt in cached state

@mks11
Copy link
Author

mks11 commented Mar 18, 2020

Thanks! the following from this link CocoaPods/CocoaPods#9260 worked -

rm -rf ~/.cocoapods/repos/trunk/

@Ehesp
Copy link
Member

Ehesp commented Mar 18, 2020

Cool, thanks for helping debug !

@mikehardy
Copy link
Collaborator

I believe react-native-clean-project is the canonical solution for purging local state to achieve clean reproducible react-native builds, so I just opened an enhancement there to add this functionality as it's a new one for me pmadruga/react-native-clean-project#42

@mks11
Copy link
Author

mks11 commented Mar 18, 2020

Thanks Mike. react-native-clean-project however didn't help me in this particular case. Maybe because I didn't want to delete the ios folder. I wonder if it removes the trunk (or it is necessary at all to remove it). Removing the trunk part was mentioned here CocoaPods/CocoaPods#9260

@mikehardy
Copy link
Collaborator

@mks11 you linked that twice but I see nothing relevant there in the 2773 link? But no, react-native-clean-project would not have worked in this case it needs an enhancement before it can work which is the item I linked - good working finding the cause

@mks11
Copy link
Author

mks11 commented Mar 18, 2020

@mikehardy Oh apologies! made the correction. This is the link CocoaPods/CocoaPods#9260

@mikehardy
Copy link
Collaborator

Thanks that helps! I cross-linked it with the react-native-clean-project enhancement request to provide it with support

@tbanj
Copy link

tbanj commented Oct 13, 2020

When I tried to upgrade my react-native package from v0.61 to v0.63. I encounter JSONParse error

below command is what i use to solve the issue

`gem list --local | grep cocoapods

sudo gem uninstall (each item from above command)

sudo rm -rf ~/.cocoapods

sudo gem install cocoapods

cd (PROJECT DIRECTORY)

pod init

(put cocoapod in podfile)

pod install

rm -rf ~/.cocoapods/repos/trunk/

pod cache clean --all

pod install`

credit from https://stackoverflow.com/a/60849495/7702345

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: user Issue with users code or an issue that should be directed to Stack Overflow or the Discord server.
Projects
None yet
Development

No branches or pull requests

5 participants