Getting Error: Cannot find module './src/init' when trying to initialize a react native app

こ雲淡風輕ζ 提交于 2019-12-01 18:44:17

It is a bug in gulp-sourcemaps 2.1.0, which has been recently released. Here is an issue for it on GitHub: https://github.com/floridoo/gulp-sourcemaps/issues/238. I believe it should be fixed soon, meanwhile you can downgrade it to 2.0.x or 1.7.x.

Update: Thanks to this GitHub comment I was able to make it work with the following steps:

$ mkdir MyProject
$ cd MyProject
$ npm i gulp-sourcemaps@1.7
$ cd ..
$ react-native init MyProject # answer yes

Actually it worked in my case but I was required to downgrade gulp-sourcemaps to version 1.7

$ cd MyProject
$ rm -rf node_modules/gulp-sourcemaps
$ npm install gulp-sourcemaps@1.7
$ cd ..
$ react-native init MyProject

This is now fixed "src" was not included in package.json. https://github.com/floridoo/gulp-sourcemaps/issues/238

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!