美文网首页工作生活
react-native init 新建0.57.1项目运行报错

react-native init 新建0.57.1项目运行报错

作者: Melody_YM | 来源:发表于2019-07-03 11:10 被阅读0次
     Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from `/Users/hjs/Desktop/worksplace/MyProject/index.js`: Module `@babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map
    
     
    
    This might be related to https://github.com/facebook/react-native/issues/4968
    
    To resolve try the following:
    
      1. Clear watchman watches: `watchman watch-del-all`.
    
      2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
    
      3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
    
      4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`. (null))
    

    解决方法:

    1. 项目根目录下运行:
    npm add @babel/runtime
    2. 重新install依赖
    npm install
    

    重新运行即可。

    相关文章

      网友评论

        本文标题:react-native init 新建0.57.1项目运行报错

        本文链接:https://www.haomeiwen.com/subject/ngfqhctx.html