英文:
Unable to create a new React Native Project (npx react-native init MyProject)
问题
我无法创建一个新的React Native项目。下面是图片链接:
而不是整个模板,我得到了node-modules、package-lock.json和package.json。
英文:
I am unable to create a new react native project. Below is the image :
Instead of the whole template, I'm getting node-modules, package-lock.json and package.json.
答案1
得分: 2
以下是已翻译的内容:
问题出现在全局安装的Yarn/NPM包的使用上,这通常不被建议。要解决此问题,您可以使用特定命令的组合来清理您的环境,具体取决于您过去是否使用-g选项安装了以下包:
-
移除全局Yarn包:
- yarn global remove react-native
- yarn global remove react-native-cli
-
移除全局NPM包:
- npm uninstall -g react-native
- npm uninstall -g react-native-cli
要确保全局包已完全移除,请检查以下列表是否有任何与react-native相关的项目:
-
Yarn全局列表:
- yarn global list
-
NPM全局列表:
- npm -g list
如果在这些列表中发现与react-native相关的内容,请将它们一并移除。
英文:
The problem arises from the use of globally installed Yarn/NPM packages, which is generally not advised. To resolve this issue, you can clean up your environment using a combination of specific commands, depending on the ones you have installed in the past with the -g option:
- yarn global remove react-native
- yarn global remove react-native-cli
- npm uninstall -g react-native
- npm uninstall -g react-native-cli
To ensure that the global packages have been completely removed, check the following lists for any remaining react-native related items:
- yarn global list
- npm -g list
If you find anything related to react-native in these lists, remove them as well.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论