【发布时间】:2019-02-19 07:04:23
【问题描述】:
安装 react-devtools 后,我无法再运行 expo-cli。 在我这样做之前,一切都很好。我现在收到以下错误。 我的 Powershell 权限也更改为“受限”。我已将注册表恢复到前一天,并已卸载/重新安装 node 和 yarn 以解决此问题。
错误列出了我的计算机上没有安装的 Cygwin(未显示在注册表搜索中),但是,搜索我的计算机,我看到 Cygwin 是随 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
任何帮助将不胜感激。
视窗 10
npm:6.6.0
节点:v10.15.0
纱线: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
@supermerio
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
此外,我可以通过将 expo 安装到我的 repo 中并从那里调用它来使其正常工作。 我注意到本地脚本与全局安装中的脚本有所不同。本地脚本调用“node”,而全局脚本(上图)调用“pwsh”。
\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
【问题讨论】:
标签: powershell react-native cygwin expo