工作生活

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

2019-07-03  本文已影响0人  Melody_YM
 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

重新运行即可。

上一篇下一篇

猜你喜欢

热点阅读