react-native-version: Syntax Error while versioning iOS
PS F:\Shared Desktop\ROBOCRAZE\RnD\alphacare\hospital_app_react> yarn version --minor yarn version v1.6.0 warning …\package.json: No license field info Current version: 0.1.0-beta question New version: error Invalid semver version question New version: 0.2.0 info New version: 0.2.0 $ react-native-version [RNV] Versioning Android… [RNV] Android updated [RNV] Versioning iOS… [RNV] SyntaxError: Expected “"”, “\'”, “\"”, “\n”, or [^\"] but “\” found.
After setting up post version hook, running the command yarn version --minor produces this error.
Platform: Windows 10
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 2
- Comments: 24 (6 by maintainers)
Commits related to this issue
- WIP #52 react-native link react-native-vector-icons — committed to stovmascript/react-native-version by stovmascript 6 years ago
- Fix #52 Add "Known issues" to README, add info for fixing paths on Windows — committed to stovmascript/react-native-version by stovmascript 6 years ago
- Fix #52 Add "Known issues" to README - Add info for fixing paths on Windows — committed to stovmascript/react-native-version by stovmascript 6 years ago
- Merge pull request #56 from stovmascript/issue-52 Fix #52 Add "Known issues" to README — committed to stovmascript/react-native-version by stovmascript 6 years ago
If it helps, offending line was:
Had to remove the
\\from\\\nfrom https://www.npmjs.com/package/@sentry/react-native
In our case it was newest react with @sentry/react-native having offending lines in shell script (copied from official Sentry documentation about workaround for RN >0.69) Here is the working shell script line in case anyone needs it:
Facing the same problem after adding a custom build script, have been using the library without any issues for a year, but stuck now. Lots of backslashes in the script to escape quotes and spaces, so not sure how to fix it.
EDIT: I’ve created an issue in
pbxproj-domto see if they have any ideas on a fixyour command line appers like this?
Found the issue, the problem comes from React Native made in Windows that will have backslashed paths inside pbxproj. It’s not a problem from your package at all @stovmascript . Check strings that are like this:
and change them to
Faced the same issue with Mac. Resolved with changing
to
The key:
\\to' 'Root reason - the file path with space in it.SyntaxError: Expected “"”, “\'”, “\"”, “\n”, or [^\"] but “\” found.
similar to above it was Sentry shell script. I am on a mac. shellScript = “export SENTRY_PROPERTIES=sentry.properties\nexport …”
in several places I had to replace
$WITH_ENVIRONMENT \\\with$WITH_ENVIRONMENT \and$REACT_NATIVE_XCODE\\\with$REACT_NATIVE_XCODE\were you able to fix it?
i have the same error on MacOs now. any one fixed this please ?
I’m experiencing this issue with Sentry.
I suspect this line is causing the problem, but I don’t know how to fix it:
shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\"\"\n\n/bin/sh ../node_modules/@sentry/react-native/scripts/collect-modules.sh\n";Any way to solve this?
It’s just because Windows uses
\instead of/for paths and when paths are written to pbxproj when usingreact-native link, they will contain backslashes, it still works when your compile on a Mac, but it will crash with the pbxproj-dom parser package that you use. You could maybe add a “Common issues” page on your README for future users.