React Native error : 'react-native' is not recognized as an internal or external command, operable program or batch file
React Native error : 'react-native' is not recognized as an internal or external command, operable program or batch file
我已经在一个多月的项目中使用 React-Native,为了创建应用程序,我卸载了 react-native-cli 并按照官方文档中的描述进行操作 (https://reactnative.dev/docs/environment-setup) .昨天,我修改了一个现有项目(来自 github)和 运行 :
- npm 安装
- npx react-native 运行-android
我遇到了一些错误,所以我更新了 npm,一切正常。我重新启动了计算机并尝试使用以下命令创建一个新应用程序:
- npx react-native init 测试
这是我得到的错误:
我卸载了 Node 并安装了最新版本 (16.0.0) 和 npm 版本 (7.11.2) 和 npx 版本 (7.11.2)。
有人可以帮我解决这个问题吗?
我认为您需要安装 react native cli,但首先将 npm 路径添加到您的环境变量;然后系统和用户都安装 npm 和 react-native cli。
如果这不起作用,解决方案是全局安装 react-native-cli 您可以使用以下命令全局安装它:
npm install -g react-native-cli
正在卸载全局包
使用这个commond
npm uninstall -g react-native-cli
然后重新启动计算机并尝试创建新应用程序
I restarted my computer and tried to create a new app using the following command: npx react-native run-android Test
在 React Native 中创建新应用 init
而不是 run-android
npx react-native init Test
我已经在一个多月的项目中使用 React-Native,为了创建应用程序,我卸载了 react-native-cli 并按照官方文档中的描述进行操作 (https://reactnative.dev/docs/environment-setup) .昨天,我修改了一个现有项目(来自 github)和 运行 :
- npm 安装
- npx react-native 运行-android
我遇到了一些错误,所以我更新了 npm,一切正常。我重新启动了计算机并尝试使用以下命令创建一个新应用程序:
- npx react-native init 测试
这是我得到的错误:
我卸载了 Node 并安装了最新版本 (16.0.0) 和 npm 版本 (7.11.2) 和 npx 版本 (7.11.2)。
有人可以帮我解决这个问题吗?
我认为您需要安装 react native cli,但首先将 npm 路径添加到您的环境变量;然后系统和用户都安装 npm 和 react-native cli。 如果这不起作用,解决方案是全局安装 react-native-cli 您可以使用以下命令全局安装它:
npm install -g react-native-cli
正在卸载全局包 使用这个commond
npm uninstall -g react-native-cli
然后重新启动计算机并尝试创建新应用程序
I restarted my computer and tried to create a new app using the following command: npx react-native run-android Test
在 React Native 中创建新应用 init
而不是 run-android
npx react-native init Test