设置路径后约 'zsh react-native command not found'

about 'zsh react-native command not found' AFTER SETTING PATH

前段时间,我在 运行 expo 时遇到命令未找到错误,所以我将路径设置在 ~/.bash_profile 等 运行 source ~/.[=19 之后=],现在我可以毫无问题地调用 expo。

今天尝试运行 react-native link 出现如下错误: zsh: react-native command not found

我还有什么地方做错了吗?

也许您没有全局安装 react native cli,这很好,因为不需要。

如果安装了react-native,请检查项目目录 所以 ./node_modules/react-native/ 应该存在并且里面有东西。

如果是,则不需要直接运行react-native;通过 npx react-native 或 npm 脚本尝试 运行ning。

如果没有,请确保 react-native 在 package.json 依赖项部分,运行 npm install 以拉取 react-native 库文件夹。