Expo/Cygwin “Unexpected Token” Problem
Closed this issue · 4 comments
Immediately 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.
In addition to not being able to run expo, my Powershell permissions were also changed to "restricted" (which I fixed). I even restored my registry to the previous day in an effort to fix this.
I have uninstalled/reinstalled node and yarn.
The error lists Cygwin. I don't know if that is the problem, but I don't have it installed on my computer (does not show up in a registry search), however, searching my computer, I see that Cygwin was installed with Git:
C:\Program Files\Git\usr\share\cygwin
C:\Program Files\Git\usr\bin\cygwin-console-helper.exe
C:\Program Files\Android\Android Studio\bin\lldb\lib\distutils\cygwinccompiler.py
C:\Program Files\Git\usr\lib\perlS\core_per|\File\Spec\cygwin.pm
C:\Program Files\Git\usr\share\cygwin\cygwin.ldif
C:\Program Files\Git\usr\share\tern1info\63\cygwin
C:\Program Files\Git\usr\lib\terminf0\63\cygwin
Any help will be GREATLY appreciated.
Windows 10
npm: 6.6.0
node: v10.15.0
yarn: v1.13.0
--ERROR--
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.
Asking around, people are suggesting that C:\Users\name\AppData\Local\Yarn\bin\expo.ps1 is not a properly formatted powershell script. It is the script that is installed by the installer.
When I run expo from a local command, it works. I've noticed that the global file calls powershell where the local call node:
C:\Users\name\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
\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
@eightbit This is a known Yarn 1.13.0
issue: yarnpkg/yarn#6902 (comment)
@kireerik Thanks a lot for pointing this out. I posted extensively about this problem - even joined the cygwin mailing list. I didn't find any other reference to it.
FWIW, I often encountered errors installing Expo with NPM, so I had switched to Yarn. I don't think there were any warnings during the Yarn install of Expo.
What finally worked was installing Expo from within a Windows Subsystem for Linux Shell (WSL) - no errors during install and the global install of Expo runs. WSL is required to compile Expo for IOS on Windoze.
I do have a question: Now that I have Expo installed via Yarn and NPM, how does Node choose which to launch?
Thanks again.
React DevTools has been rewritten and recently launched a new version 4 UI. The source code for this rewrite was done in a separate repository and now lives in the main React repo (github.com/facebook/react).
Because version 4 was a total rewrite, and all issues in this repository are related to the old version 3 of the extension, I am closing all issues in this repository. If you can still reproduce this issue, or believe this feature request is still relevant, please open a new issue in the React repo: https://github.com/facebook/react/issues/new?labels=Component:%20Developer%20Tools