ENOENT:没有这样的文件或目录,React Native,EXPO

时间:2019-07-11 15:20:20

标签: javascript reactjs native expo

我刚开始使用EXPO来构建应用程序,但是在Expo开发人员工具中,我得到了错误“ ENOENT:没有这样的文件或目录,正在构建JavaScript错误”我的文件/目录存在,但是我很好奇知道为什么会出现此错误发生以及如何解决它。

我的代码有错误吗? package.json有问题吗?

我尝试卸载并重新安装npm, 我已经删除了节点模块并重新安装了它, 我还安装了对等依赖项,

但似乎没有一个可以解决该问题。

APP.JS中的代码

    import React from 'react';
    import { View } from 'react-native';
    import Home from './pages/Home';


    export default function App() {
      return (
       <View>
         <Home/>

       </View>
      );
    }

在HOME.JS中输入代码

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


    function Home() {
      return (
         <View style={styles.container}>
              <Text style={styles.text}>Welcome to Chat</Text>
              <Image style={styles.image} source= 
              {require('./assets/Lolimagememe.png')} />
              <Button title="Let's Discuss"/>
              <Button title="PRIVACY POLICY" type="clear"/>
              <Button title="TERMS OF SERVICE" type="clear"/>

         </View>
        );
     }

     const styles = StyleSheet.create({
      container: {
       flex: 1,
       backgroundColor: '#00BFFF',
       alignItems: 'center',
       justifyContent: 'center',
    },

    text: {
       fontSize: 23,
       color: "white"
    },

    image: {
       height: 100,
       width: 100,
       position: "relative",
       top: -150
     }
    });

    export default Home;

1 个答案:

答案 0 :(得分:0)

在您的终端中尝试killall node并启动应用。