4

When I try to install react native with the command react-native init ProjectName

I get the following:

This will walk you through creating a new React Native project in C:\Users\Xegano\Documents\ProjectName
Installing react-native package from npm...
Setting up new React Native app in C:\Users\Xegano\Documents\ProjectName
module.js:457
    throw err;
    ^

Error: Cannot find module './src/init'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Xegano\Documents\ProjectName\node_modules\gulp-sourcemaps\index.js:4:9)
    at Module._compile (module.js:556:32)
    at Module._extensions..js (module.js:565:10)
    at Object.require.extensions.(anonymous function) [as .js] (C:\Users\Xegano\Documents\ProjectName\node_modules\babel-register\lib\node.js:152:7)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)

Why does this happen? It used to work earlier the only thing I remember I changed is some packages from the SDK Manager. Could it be that?

1

3 Answers 3

4

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 [email protected]
$ cd ..
$ react-native init MyProject
Sign up to request clarification or add additional context in comments.

Comments

3

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 [email protected]
$ cd ..
$ react-native init MyProject # answer yes

1 Comment

Thanks, explains a lot
0

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

1 Comment

Is it really fixed? As I keep on getting error still!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.