首页 > 解决方案 > 将项目从 android 移动到 iOS 时出现 npm 错误?

问题描述

我正在将我的 React Native 项目从 Windows Android 转移到 MacOS for IOS。该项目由以下机构发起:

npx react-native init myproj

然后测试:

npx react-native run-ios

它与模拟器一起工作。package.json, App.js然后我将and 组件复制到myprojand run yarn install。但现在run-ios抛出关于以下的错误npm

npx react-narive run-ios
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/react-narive - Not found
npm ERR! 404 
npm ERR! 404  'react-narive@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

试过了npx set config registry https://registry.npmjs.org/,但没有帮助。

由于我没有npm用于模块安装,是什么导致了错误以及如何修复?

标签: react-native-ios

解决方案


只需通过以下方式将 react native cli 模块更新为最新版本@react-native-community/cli

yarn add @react-native-community/cli

pod install/ios.

社区 cli 的当前版本是3.0.4. 以前安装的 cli 版本2.0.1react-native-cli过时。


推荐阅读