how to run an existing project of react native

2019-09-19 23:00发布

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 core-js@1.2.7:
 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
 connect@2.30.2: 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?

4条回答
Viruses.
2楼-- · 2019-09-19 23:33

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
查看更多
不美不萌又怎样
3楼-- · 2019-09-19 23:43

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 
查看更多
神经病院院长
4楼-- · 2019-09-19 23:48

possible answer: NPM, cannot find 'graceful-fs', no matter what I do he had the same issue of Error: Cannot find module 'graceful-fs'

查看更多
Melony?
5楼-- · 2019-09-19 23:49

From a computer with node install, you navigate a command line to the root of the project folder.

Then you install dependencies:

npm i

This installs all the libraries the project needs to build

Then you run the projects build script. This is defined in the projects package.json file. In that projects case, the script is called start. So:

npm run start

查看更多
登录 后发表回答