2017-04-09 62 views
1

我无法运行Native AwesomeProject项目的示例反应。React Native Error - yarn'不被识别为内部或外部命令

任何人都可以帮忙吗?以下是详细信息。

C:\Users\dip\AwesomeProject>react-native run-android 'yarn' is not recognized as an internal or external command, operable program or batch file.
Scanning 557 folders for symlinks in C:\Users\dip\AwesomeProject\node_mo ules (31ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat instal Debug)...
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

回答

4

纱线是由facebook创建的工具,作为npm的高效替代品。在你的情况下..它只是告知Yarn没有安装在你的系统中。这不是罪魁祸首。

问题出在Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object Could not install the app on the device一行。它看起来像是Java安装的错误。

解决方案:登录C:\Windows\System32目录,并删除java.exe(或像java.exe.old重命名为)

参考更多详细信息https://stackoverflow.com/a/30577609/5597641这个答案。

btw您可以在命令提示符处输入npm install -g yarn来安装纱线。

5

我面临同样的问题,它得到了通过以下命令

NPM解决安装-g纱

相关问题