Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Android - init fails

I am attempting to create a new React Native project for Android. I followed the instructions here but when I attempt to init a new project using the command react-native init TestProject I get the following error

This will walk you through creating a new React Native project in D:\dev\projects\TestProject
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: spawn npm ENOENT
    at exports._errnoException (util.js:837:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at doNTCallback2 (node.js:429:9)
    at process._tickCallback (node.js:343:17)
    at Function.Module.runMain (module.js:477:11)
    at startup (node.js:117:18)
    at node.js:951:3

Not sure where to get more information about the error. I have Node v4, NPM v2.14. Another thing to note is that the folder that gets created has a package.json that references node_modules/react-native/packager which does not exist in the current directory or the global scope.

Any suggestions would be greatly appreciated.

like image 800
mmeza84 Avatar asked Jul 21 '26 06:07

mmeza84


2 Answers

I try it too and I met the same problem. Then I found this issue: https://github.com/facebook/react-native/issues/2681

As said in the document: OS X - Only OS X is currently supported, and I'm using Windows which cause the issue.

I notice the path: D:\dev\projects\TestProject\events.js, so you are using Windows too.

like image 108
Leo Gao Avatar answered Jul 22 '26 19:07

Leo Gao


It's a platform issue. Only OSX is supported see Issue and possible workarounds

like image 34
Taurai Benhura Avatar answered Jul 22 '26 20:07

Taurai Benhura