4
votes

I am using this tutorial https://facebook.github.io/react-native/docs/getting-started.html#content I am using windows 8. I have print npm install -g react-native-cli. Then

react-native init AwesomeProject
cd AwesomeProject

Then I have read that on windows I can't use this command react-native run-android so I print node node_modules/react-native/packager/packager.js as suggested here https://facebook.github.io/react-native/docs/linux-windows-support.html#content And I get the following output:

Error: Cannot find module 'C:\Windows\System32\AwesomeProject\node_modules\react -native\packager\packager.js' at Function.Module._resolveFilename (module.js:337:15) at Function.Module._load (module.js:287:25) at Function.Module.runMain (module.js:457:10) at startup (node.js:136:18) at node.js:972:3

Myawesomeproject folder has 2 files npm-debug.log and package.json

So I feel like something went wrong. Ho can I fix this?

1
It looks like react-native init doesn't really work on Windows. There might be a possible workaround here - Blake Hair
@Blake Hair so does it properly works on linux or ubuntu? - user2950593
I imagine it might, but I haven't tested it. It looks like a lot of the scripts rely on things fairly common in unix, which is why they don't handle Windows. - Blake Hair
Have you tried the command react-native start, instead calling the packager directly? - purii
From your error message, it looks as if you don't have a react-native directory in your node modules. Have you made sure that you ran npm install before attempting the node command? - Alexander Kuzmin

1 Answers

0
votes

It seems like npm is not installed correctly on your machine. You may test it by calling npm install in the generated directory. If it runs successfully and the node_modules folder in that directory is filled your are good to go. You should then run the react-native init command again so it can generate everything correctly.