Reputation: 100
I am trying to create react native project with following command but getting error, Help me gyus:
react-native init Sample
Following error occurs:
This will walk you through creating a new React Native project in D:\React_Demos\Sample
Using yarn v1.17.3
Installing react-native...
yarn add v1.17.3
info No lockfile found.
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.npmjs.org/react-native: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 8888".
info If you think this is a bug, please open a bug report with the information provided in "D:\React_Demos\Sample\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Error: Command failed: yarn add react-native --exact
at checkExecSyncError (child_process.js:621:11)
at execSync (child_process.js:657:15)
at run (C:\Users\sachin.salunkhe\AppData\Roaming\npm\node_modules\react-native-cli\index.js:294:5)
at createProject (C:\Users\sachin.salunkhe\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
at init (C:\Users\sachin.salunkhe\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)
at Object. (C:\Users\sachin.salunkhe\AppData\Roaming\npm\node_modules\react-native-cli\index.js:153:7)
at Module._compile (internal/modules/cjs/loader.js:777:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:788:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 10924,
stdout: null,
stderr: null
}
Command yarn add react-native --exact
failed.
Here is the yarn.log file:
Arguments: C:\Program Files\nodejs\node.exe C:\Users\sachin.salunkhe\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js add react-native --exact
PATH: C:\Python27\;C:\Python27\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\PuTTY\;C:\Users\sachin.salunkhe\AppData\Roaming\npm;C:\adb;C:\Program Files\Apache Software Foundation\apache-maven-3.5.4;\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_211\bin;C:\Users\sachin.salunkhe\AppData\Roaming\npm;C:\Program Files\nodejs\;C:\Users\sachin.salunkhe\AppData\Local\Android\Sdk\emulator\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\Apache Software Foundation\apache-maven-3.5.4\bin;C:\Program Files\Java\jdk1.8.0_181\;C:\Users\sachin.salunkhe\AppData\Local\Programs\Fiddler;C:\Users\sachin.salunkhe\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\sachin.salunkhe\AppData\Local\Yarn\bin
Yarn version: 1.17.3
Node version: 12.7.0
Platform: win32 x64
Trace: Error: https://registry.npmjs.org/react-native: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 8888 at ClientRequest.onError (C:\Users\sachin.salunkhe\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:151950:17) at Object.onceWrapper (events.js:291:20) at ClientRequest.emit (events.js:203:13) at Socket.socketErrorListener (_http_client.js:399:9) at Socket.emit (events.js:203:13) at emitErrorNT (internal/streams/destroy.js:91:8) at emitErrorAndCloseNT (internal/streams/destroy.js:59:3) at processTicksAndRejections (internal/process/task_queues.js:77:11)
npm manifest: {"name":"Sample","version":"0.0.1","private":true,"scripts":{"start":"node node_modules/react-native/local-cli/cli.js start"}}
yarn manifest: No manifest
Lockfile:
Upvotes: 1
Views: 7048
Reputation: 9
If you navigate to your npm folder before issuing the command, it should work, then you can always move the folder. So cd C:\Users\User\AppData\Roaming\npm
Then run
react-native init AppName
Upvotes: 0
Reputation: 787
I hope this is helpful for him.
1) Remove node_modules then update react native-cli with latest version.
2) npm install
3) react-native link
4) After that this command : react-native run-android
Upvotes: 0
Reputation: 1102
First, remove node modules then install it again then install react-native cli. After that run init command.
Upvotes: 0
Reputation: 13906
Make sure you have carried out this course.
choco install -y nodejs.install python2 jdk8
// If there is no choco, install it.npm install -g react-native-cli
Android Studio
// and setting Configure the ANDROID_HOME
environment variable. and new SDKreact-native init AwesomeProject
Upvotes: 0
Reputation: 413
First You Can Run This Command,
sudo npm install -g react-native-cli
then after run this command,
react-native init Sample
Upvotes: 3