简体   繁体   English

模块 '"./node_modules/react-native"' 没有导出的成员 'View'

[英]Module '"./node_modules/react-native"' has no exported member 'View'

After i convert my project in typescript showing me following error Module '"./node_modules/react-native"' has no exported member 'View'.在我在 typescript 中转换我的项目后,向我显示以下错误模块 '"./node_modules/react-native"' 没有导出的成员 'View'。

import React from 'react';
import {StyleSheet,View,Text} from 'react-native';

export default function App() {
return (
  <View style={{ flex: 1 }}>
    <Text>Welcome</Text>
  </View>
 );
}
  1. Delete your node_modules folder删除你的node_modules文件夹
  2. run this on your terminal npm install @types/react @types/react-native在你的终端上运行这个npm install @types/react @types/react-native
  3. close the editor and restart everything.关闭编辑器并重新启动一切。

Delete node_modules folder and run npm install or yarn again.删除node_modules文件夹并再次运行npm installyarn

If it not solve this problem, try to run npm install @types/react @types/react-native or yarn add @types/react @types/react-native如果不能解决这个问题,尝试运行npm install @types/react @types/react-nativeyarn add @types/react @types/react-native

Probably you should also use -D option to install it as a development dependency, which adds it to the devDependencies list.可能您还应该使用 -D 选项将其安装为开发依赖项,这会将其添加到 devDependencies 列表中。

npm install --save-dev @types/react @types/react-native
(npm install -D @types/react @types/react-native)

or或者

yarn add --dev @types/react @types/react-native
(yarn add -D @types/react @types/react-native)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Vue 和 Quasar - 模块 '“../../node_modules/vue/types”' 没有导出的成员 'defineComponent' - Vue and Quasar - Module '“../../node_modules/vue/types”' has no exported member 'defineComponent' read.ts(6133)模块&#39;“ ../../../node_modules/rxjs/observable/combineLatest”&#39;没有导出的成员&#39;combineLatest&#39;.ts(2305) - read.ts(6133) Module '“../../../node_modules/rxjs/observable/combineLatest”' has no exported member 'combineLatest'.ts(2305) 如何查看react-native node_modules更改 - How to watch react-native node_modules changes Typescript 模块 xyz 没有库 node_modules 的专家成员 - Typescript module xyz has no experted member for library node_modules React Rollup:'name' 不是由 node_modules/ 导出的 - React Rollup: 'name' is not exported by node_modules/ 使用Jest测试时,node_modules / react-native / Libraries / Modal / Modal.js中的错误 - Error in node_modules/react-native/Libraries/Modal/Modal.js while testing with Jest 运行测试时无法从“node_modules/react-native/jest/setup.js”中找到模块“@babel/runtime/helpers/interopRequireDefault” - Cannot find module '@babel/runtime/helpers/interopRequireDefault' from 'node_modules/react-native/jest/setup.js' when I run tests 打字稿/反应:模块没有导出成员 - Typescript/React: Module has no exported member 无法从“node_modules/react-native/Libraries/ART/ARTSerializablePath.js”解析“art/core/class.js” - Unable to resolve "art/core/class.js" from "node_modules/react-native/Libraries/ART/ARTSerializablePath.js" node_modules 错误未导出统计信息 - 汇总 - Stats is not exported by node_modules error - Rollup
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM