Cli: [!] Invalid `Podfile` file: 784: unexpected token at '(node:12804)

Created on 29 Jun 2019  ·  23Comments  ·  Source: react-native-community/cli

Environment

System:
    OS: macOS High Sierra 10.13.6
    CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
    Memory: 202.45 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.16.0 - /usr/local/bin/node
    Yarn: 1.3.2 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    Android SDK:
      API Levels: 22, 23, 24, 25, 26, 27, 28
      Build Tools: 25.0.0, 27.0.3, 28.0.3
      System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.2 AI-181.5540.7.32.5014246
    Xcode: 10.1/10B61 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.0-rc.3 => 0.60.0-rc.3

Description

when i run react-native init RN060 --version react-native@next on Mac OS terminal

report follow error information:

├─ [email protected]
└─ [email protected]
✨  Done in 28.97s.
info Installing required CocoaPods dependencies

[!] Invalid `Podfile` file: 784: unexpected token at '(node:12804) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
'.

 #  from /Users/lg/RN060/ios/Podfile:36
 #  -------------------------------------------
 #  
 >    use_native_modules!
 #  end
 #  -------------------------------------------

(node:12744) UnhandledPromiseRejectionWarning: Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./RN060/ios && pod install".
CocoaPods documentation: https://cocoapods.org/
    at installPods (/Users/lg/RN060/node_modules/@react-native-community/cli/build/tools/installPods.js:148:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:12744) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:12744) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

pod --version
1.7.3

Reproducible Demo

no demo

bug

Most helpful comment

My issue was that I had react-native-cli as a dependency, Everything worked fine once I removed it and the error didn't show up again. Hope somebody might find this useful.

All 23 comments

I tried using CocoaPods 1.6.1 and 1.7.3 on macOS, same Node version, newer Yarn (1.16), but cannot repro. Is this happening consistently? Can you try with Yarn 1.16?

@orta @alloy ideas on what could go wrong? Seems like the error is coming from CocoaPods and it happens only on some environments/machines.

@lgj1993 Hey guys! upgrade the your yarn to 1.16 can be fix this issue.

Run following sh command on the terminal:

curl -o- -L https://yarnpkg.com/install.sh | bash

Cheers,just like you say, upgrade the yarn to latest version, pod install is working. @thymikee and @Kennytian , you're really smart guys!

Super thanks from Wuhan, China! 🇨🇳

@thymikee This problem is because yarn --silent run-native config can not work with Yarn version 1.3.2?

But Yarn 1.6.1 can run yarn --silent run-native config

@Kennytian looks like --silent is supported in Yarn 1.3.1, however it also spawns some Node deprecation messages what are corrupting the JSON output. I've sent #449 to address that by removing running config through Yarn.

It might not be caused by a specific yarn version, I'm experiencing the same issue on the following environment:

System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 2.87 GB / 16.00 GB
    Shell: 5.7.1 - /usr/local/bin/zsh
  Binaries:
    Node: 10.13.0 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 23, 24, 25, 26, 27, 28
      Build Tools: 26.0.3, 27.0.3, 28.0.2, 28.0.3
      System Images: android-25 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
      Android NDK: 17.2.4988734
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6
    react-native: 0.60.0-rc.3 => 0.60.0-rc.3

Yarn may output some other validation messages that are not stripped out when ran with --silent. We'll just use node to run the command.

@thymikee Yep, that sounds like the best course 👍

Thanks @alloy 🚀

I'm still experiencing this error. Here's my react-native info output:

System:
    OS: macOS 10.14
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Memory: 462.89 MB / 10.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.6.0 - /usr/local/bin/node
    Yarn: 1.17.3 - ~/.npm-global/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.1
      System Images: android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: /undefined - /usr/bin/xcodebuild

I'd really appreciate any help on this. Is there a --verbose flag to get more information on what may be causing the issue?

Xcode: /undefined - /usr/bin/xcodebuild

This looks fishy. Do you have a working Xcode environment?

I'd really appreciate any help on this. Is there a --verbose flag to get more information on what may be causing the issue?

You can run pod install --verbose.

Also, please update the @react-native-community/cli to the latest version, we're constantly rolling fixes and improvements.

@thymikee I don't - I have Xcode CLT (Command-Line Tools) installed, though. Does CocoaPods require Xcode itself to run commands? Another thing I noticed is, after this error, the new project is deleted, so I can't run pod install manually.

Another thing I noticed is, after this error, the new project is deleted, so I can't run pod install manually

Ugh, we need to fix that, because it's not productive in this case. Would you like to contribute that?

Sure @thymikee I'll look into it and submit a pull request. any edge cases to consider?

We should always remove the temporary directory where template lives, but I think we can safely get rid of removing the new project when something fails

@thymikee PR created here: #569

I tried using CocoaPods 1.6.1 and 1.7.3 on macOS, same Node version, newer Yarn (1.16), but cannot repro. Is this happening consistently? Can you try with Yarn 1.16?

"Your replies are many but none is relevant to the issue, please reply to the issue and provide a solution" Request you to please respond only if you are aware about the solution

If it's a project using apollo etc, npm doesn't work, make sure you're using yarn package manager, this was the reason for me, so yarn install; cd ios; pod install;

My issue was that I had react-native-cli as a dependency, Everything worked fine once I removed it and the error didn't show up again. Hope somebody might find this useful.

@A-Tokyo doing the same stuff here hehehe.... have taken some hours to solve xD

@tugzera Been there, done that xD

Same here, would it be possible to add that info somewhere?, like in the readme file?, so far it says:

react-native-cli – an optional global convenience package, which is a proxy to @react-native-community/cli and global installation helper. Please consider it legacy, because it's not necessary anymore.

It might say something like:

react-native-cli – an optional global convenience package, which is a proxy to @react-native-community/cli and global installation helper. Please consider it legacy, because it's not necessary anymore.
NOTE: It might also cause some issues like [!] Invalid 'Podfile' file: 784: unexpected token at, so you should consider to remove this package from your dependencies.

Does it make sense?

CC: @thymikee

Was this page helpful?
0 / 5 - 0 ratings