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

SyntaxError: Expected "\"", "\\'", "\\\"", "\\n", or [^\\"] but "\\" found. #327

Open
alainib opened this issue Aug 23, 2023 · 9 comments
Open

Comments

@alainib
Copy link

alainib commented Aug 23, 2023

hello

i'm getting this error now. i'm note sur from where it come and absolutly not how to fix it.

i'm running

yarn version --new-version 0.2.8-0 --message chore(release): v%s

my package version are

"react-native": "0.72.4",
"react-native-version": "4.0.0",

i was working good with lower version of react native, i'm using macos so no problem of slash or antislash like with windows in path.

any tips are more than welcomed thanks

@batical
Copy link

batical commented Aug 23, 2023

If you have expo 49, have a look at the script expo-configure

Or if you have sentry, look at the script (fix can be found in issue on this repo)

@alainib
Copy link
Author

alainib commented Aug 23, 2023

thanks for helping @batical
i use expo 49 yes but not for building, only to use some of there component

"expo": "^49.0.0",
"expo-constants": "^14.2.1",
"expo-contacts": "^12.2.0",
"expo-image-manipulator": "^11.3.0",
"expo-linear-gradient": "^12.3.0",
"expo-media-library": "^15.4.1",
"expo-modules-core": "^1.5.9",
"expo-splash-screen": "^0.20.5",
"@expo/cli@0.10.11"

the only match with expo-configure i have is expo-configure-project.sh in path

  • .../ios/Pods/Target Support Files/Pods-MYAPP-MYAPPTests/expo-configure-project.sh
  • .../ios/Pods/Target Support Files/Pods-MYAPP/expo-configure-project.sh

but i don't see any in the content


#!/usr/bin/env bash
# @generated by expo-modules-autolinking

set -eo pipefail

function with_node() {
  # Start with a default
  export NODE_BINARY=$(command -v node)

  # Override the default with the global environment
  ENV_PATH="$PODS_ROOT/../.xcode.env"
  if [[ -f "$ENV_PATH" ]]; then
    source "$ENV_PATH"
  fi

  # Override the global with the local environment
  LOCAL_ENV_PATH="${ENV_PATH}.local"
  if [[ -f "$LOCAL_ENV_PATH" ]]; then
    source "$LOCAL_ENV_PATH"
  fi

  if [[ -n "$NODE_BINARY" && -x "$NODE_BINARY" ]]; then
    echo "Node found at: ${NODE_BINARY}"
  else
    cat >&2 << NODE_NOT_FOUND
error: Could not find "node" executable while running an Xcode build script.
You need to specify the path to your Node.js executable by defining an environment variable named NODE_BINARY in your project's .xcode.env or .xcode.env.local file.
You can set this up quickly by running:

echo "export NODE_BINARY=\$(command -v node)" >> .xcode.env

in the ios folder of your project.
NODE_NOT_FOUND

    exit 1
  fi

  # Execute argument, if present
  if [[ "$#" -gt 0 ]]; then
    "$NODE_BINARY" "$@"
  fi
}

with_node --no-warnings --eval "require('expo-modules-autolinking')(process.argv.slice(1))" generate-package-list  --target "/Users/dev/my-app/ios/Pods/Target Support Files/Pods-MyApp/ExpoModulesProvider.swift"

maybe this line is wrong in /Users/dev/my-app/ios/MyApp.xcodeproj/project.pbxproj

		shellScript = "# This script configures Expo modules and generates the modules provider file.\nbash -l -c \"./Pods/Target\\ Support\\ Files/Pods-MyApp-MyAppTests/expo-configure-project.sh\"\n";

@batical
Copy link

batical commented Aug 23, 2023

yes the line in the project.pbxproj file was the culprit for me

don't have access to my code right now but i had to change it

@danilocanalle
Copy link

Did you resolve it? @alainib

@cryser29
Copy link

There are two approaches to temporary solve this issue:

  1. Delete \\ from project.pbxproj file, run yarn version and then revert those changes. But it's very inconvenient to do it manually. Using automatic replacement like sed is an option, but the postversion script in the package.json will look terrible

  2. Use -L, --legacy for react-native-version. It seams that agvtool works good with \\ characters.

For now I use the second approach.

@mieszko4
Copy link

  1. Use -L, --legacy for react-native-version. It seams that agvtool works good with \ characters.

That did not work for me because my CFBundleVersion and CURRENT_PROJECT_VERSION gets reset for some reason.

@krmao
Copy link

krmao commented Dec 12, 2023

change

set -e

WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"

/bin/sh -c "$WITH_ENVIRONMENT \"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\""

to

set -e

WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"

/bin/sh -c "$WITH_ENVIRONMENT '/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE'"

@mieszko4
Copy link

mieszko4 commented May 8, 2024

Related issue NativeScript/pbxproj-dom#9

@mieszko4
Copy link

mieszko4 commented May 8, 2024

Changing \\ to ' ' worked for me (as suggested in #52 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants