how to run an existing project of react native

18,271

Solution 1

When you download after you need to install all package in package.json

npm install --save

then you need to start another terminal

npm start -- --reset-cache / npm start / react-native start 

It's for starting your bundler

finally you can run your project

react-native run-android 

Solution 2

all dependencies and plugins have configured in package.json file. so you need to install:

npm install

then, you can start

react-native run-android

or

npm run start
Share:
18,271
Михаил Чаушевский
Author by

Михаил Чаушевский

Updated on July 12, 2022

Comments

  • Михаил Чаушевский
    Михаил Чаушевский almost 2 years

    I wanted to download and run someone else's project in order to consider its functions. I ran into a number of problems ... that it does not deign to start, and I just don’t know what to do, help, please

    https://github.com/sunlight3d/react_native_v0.49/tree/master/61-Realm%20React%20Native%235.Filter%20data%20and%20working%20with%20To-Many%20Relationships/code/tutorialProject

    1) copied to the working folder tutorial project

    2) opened VS code

    3) went into the working folder and clicked open in cmd folder tutorial project

    4) then I enter react-native run-android and get fiasco

    d:\JS\tutorialProject>react-native init tutorialProject
     internal/modules/cjs/loader.js:657 throw err; ^
    
     Error: Cannot find module 'graceful-fs' at
     Function.Module._resolveFilename
     (internal/modules/cjs/loader.js:655:15) at Function.Module._load
     (internal/modules/cjs/loader.js:580:25) at Module.require
     (internal/modules/cjs/loader.js:711:19) at require
     (internal/modules/cjs/helpers.js:14:16) at Object.<anonymous>
     (d:\JS\tutorialProject\node_modules\react-native\local-cli\cli.js:12:1)
     at Module._compile (internal/modules/cjs/loader.js:805:30) at
     Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10)
     at Module.load (internal/modules/cjs/loader.js:672:32) at
     tryModuleLoad (internal/modules/cjs/loader.js:612:12) at
     Function.Module._load (internal/modules/cjs/loader.js:604:3)
    

    I started googling and found something to do with some dependencies. Using react-native init MyProject

    5) react-native init tutorialProject and getting the tighter right line

    I try to start the server through npm and then it's funny ... 6) npm-intall

    d:\JS\tutorialProject>npm install npm WARN deprecated [email protected]:
     core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3
     or at least to actual version of core-js@2. npm WARN deprecated
     [email protected]: connect 2.x series is deprecated npm ERR! path
     d:\JS\tutorialProject\node_modules\.bin\react-native npm ERR! code
     EEXIST npm ERR! Refusing to delete
     d:\JS\tutorialProject\node_modules\.bin\react-native: is outside
     d:\JS\tutorialProject\node_modules\react-native and not a link npm
     ERR! File exists: d:\JS\tutorialProject\node_modules\.bin\react-native
     npm ERR! Move it away, and try again.
    
     npm ERR! A complete log of this run can be found in: npm ERR!
     C:\Users\Nick\AppData\Roaming\npm-cache\_logs\2019-04-16T18_15_13_614Z-debug.log
    

    and here I am absolutely don't know. How to run someone else's project?

  • errorau
    errorau about 5 years
    can you share u node version node -v and npm -v
  • Михаил Чаушевский
    Михаил Чаушевский about 5 years
    npm 6.9.0 node 11.13.0
  • Михаил Чаушевский
    Михаил Чаушевский about 5 years
    when i write npm install i have a error ___ path d:\JS\tutorialProject\node_modules.bin\react-native npm ERR! code EEXIST npm ERR! Refusing to delete d:\JS\tutorialProject\node_modules.bin\react-native: is outside d:\JS\tutorialProject\node_modules\react-native and not a link npm ERR! File exists: d:\JS\tutorialProject\node_modules.bin\react-native npm ERR! Move it away, and try again.
  • Narasimhan R
    Narasimhan R about 5 years
    delete node_modules folder and tryagain it will work.... cuz those file already exist there so error..
  • Tomer Shetah
    Tomer Shetah over 3 years
  • Asyraf Roszaki
    Asyraf Roszaki over 3 years
    Thanks for the notice. Actually this is the answer rather than questions.
  • Narasimhan R
    Narasimhan R over 2 years
    use commend react-native/run-android