“无法创建新的React Native项目 (npx react-native init MyProject)”

huangapple go评论55阅读模式
英文:

Unable to create a new React Native Project (npx react-native init MyProject)

问题

我无法创建一个新的React Native项目。下面是图片链接:“无法创建新的React Native项目 (npx react-native init MyProject)”

而不是整个模板,我得到了node-modules、package-lock.json和package.json。

英文:

I am unable to create a new react native project. Below is the image : “无法创建新的React Native项目 (npx react-native init MyProject)”

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.

huangapple
  • 本文由 发表于 2023年4月17日 18:24:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76034147.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定