首页 > 解决方案 > 我在创建 apk 文件博览会时遇到这种类型的错误

问题描述

我用于expo build:android创建应用程序

   Error: Can't find react-native in package.json dependencies
    Error: react-native is not installed. Please run `npm install` or `yarn` in your project directory.
    There is an error with your project. See above logs for information.
    Error: There is an error with your project. See above logs for information.
        at C:\Users\softb\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:665:15
        at Command.<anonymous> (C:\Users\softb\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:346:7)

顺便说一句,我npm install react-native是从我的默认 cmd 安装的。但是当我尝试从项目目录安装时,我得到了这个错误。

I:\Codecanyon\singal res\code>npm install react-native
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react@16.13.1
npm WARN node_modules/react
npm WARN   peer react@"16.13.1" from react-native@0.63.4
npm WARN   node_modules/react-native
npm WARN     react-native@"*" from the root project
npm WARN     1 more (@unimodules/react-native-adapter)
npm WARN   1 more (react-native-web)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"17.0.1" from react-dom@17.0.1
npm WARN node_modules/react-dom
npm WARN   peer react-dom@">=16.5.1" from react-native-web@0.13.18
npm WARN   node_modules/react-native-web
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@bit%2fstryber.matterhorn.loading-skeleton - Not found
npm ERR! 404
npm ERR! 404  '@bit/stryber.matterhorn.loading-skeleton@^0.0.1' 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.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\softb\AppData\Local\npm-cache\_logs\2021-02-05T08_10_48_624Z-debug.log

标签: reactjsreact-native

解决方案


尝试删除node_modules文件夹,然后重新安装依赖项npm install

还要确保expo build:android在项目的根目录中运行命令。


推荐阅读