作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在努力尝试使用 Visual Studio 代码和 react-native 设置一个简单的应用程序。我遵循了入门教程 https://github.com/Microsoft/vscode-react-native .我已将所需的扩展安装到 Visual Studio 代码中(主要 react native 工具)。我还设置了各种全局变量(ANDROID_HOME、JAVA_HOME)。我使用 genymotion 作为我的模拟器。
设置好环境后,我使用 react-native-cli 创建了一个 react-native 项目:
react-native init my_project
React-native: run-android
{
"name": "poxx",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.4.1",
"react-native": "0.39.2"
},
"devDependencies": {
"babel-jest": "17.0.2",
"babel-preset-react-native": "1.9.0",
"jest": "17.0.3",
"react-test-renderer": "15.4.1"
},
"jest": {
"preset": "react-native"
}
}{
"name": "poxx",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.4.1",
"react-native": "0.39.2"
},
"devDependencies": {
"babel-jest": "17.0.2",
"babel-preset-react-native": "1.9.0",
"jest": "17.0.3",
"react-test-renderer": "15.4.1"
},
"jest": {
"preset": "react-native"
}
}
最佳答案
这是 react-native-cli@2.0.0
中的一个已知错误并且已经有 PR 等待合并。这应该在 react-native-cli
的下一个版本中修复.目前,解决方法是恢复到早期版本,例如。 react-native-cli@.1.3.0
.
如前所述,您可以使用 npm i -g react-native-cli@1.3.0
安装它。
可以在此处找到有关该错误的更多信息:react-native/issues/11463在这里:vscode-react-native/issues/365
关于react-native - Visual Studio 代码 react-native : Current workspace is not a React Native project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41111065/
我是一名优秀的程序员,十分优秀!