Expo Fails with "Unexpected Token"

#1

Hello:
After installing react-devtools, I am no longer able to run expo-cli.
Everything was working fine until I did that. I’m now getting the error below.
I’ve uninstalled the react-devtools, expo, expo-cli, and create-react-native-app, and also restored my registry to an earlier day. I then reinstalled expo-cli. I don’t know why expo would reference CYGWIN, I don’t think it is installed on my computer - a search of my registry for “cygwin” finds nothing.

Any help will be GREATLY appreciated.
Windows 10
npm: 6.4.1
node: v8.11.4
yarn: v1.13.0

expo start --android
At C:\Users\name\AppData\Local\Yarn\bin\expo.ps1:5 char:13
+     *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+             ~
Unexpected token ')' in expression or statement.
At C:\Users\name\AppData\Local\Yarn\bin\expo.ps1:8 char:3
+ if [ -x "$basedir/pwsh" ]; then
+   ~
Missing '(' after 'if' in if statement.
At C:\Users\name\AppData\Local\Yarn\bin\expo.ps1:8 char:5
+ if [ -x "$basedir/pwsh" ]; then
+     ~
Missing type name after '['.
At C:\Users\name\AppData\Local\Yarn\bin\expo.ps1:9 char:20
+ ... edir/pwsh"  "$basedir/../Data/global/node_modules/.bin/expo.ps1" "$@" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '"$basedir/../Data/global/node_modules/.bin/expo.ps1"' in expression or statement.
At C:\Users\name\AppData\Local\Yarn\bin\expo.ps1:9 char:73
+ ... edir/pwsh"  "$basedir/../Data/global/node_modules/.bin/expo.ps1" "$@"
+                                                                      ~~~~
Unexpected token '"$@"' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : UnexpectedToken
#2

Still trying to figure this out. It seems like there is a config problem somewhere…

I was able to get expo working by installing it into my repo and calling it from there.
I noticed a difference in the local script vs the script in the global install. The local script calls “node” where the global script calls “pwsh” (which produces the error):

Call in local repo \LactFacts\lactfact_190118\node_modules.bin\expo:

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/node" ]; then
  "$basedir/node"  "$basedir/../expo-cli/bin/expo.js" "$@"
  ret=$?
else 
  node  "$basedir/../expo-cli/bin/expo.js" "$@"
  ret=$?
fi
exit $ret

Call to global install C:\Users\Mitch\AppData\Local\Yarn\bin\expo.ps1

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/pwsh" ]; then
  "$basedir/pwsh"  "$basedir/../Data/global/node_modules/.bin/expo.ps1" "$@"
  ret=$?
else 
  pwsh  "$basedir/../Data/global/node_modules/.bin/expo.ps1" "$@"
  ret=$?
fi
exit $ret

So it appears that PowerShell is choking on the script:

At C:\Users\Mitch\AppData\Local\Yarn\bin\expo.ps1:5 char:13
+     *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+             ~
Unexpected token ')' in expression or statement.
closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.