'React native init is not working in new fresh project
I'm trying to create a fresh project with react-native 0.59.8 but is failing.
I have tried different versions of react-native so I think the problem is in yarn, node or npm versions that i'm using.
{ Error: Command failed: yarn add react-native --exact
at checkExecSyncError (child_process.js:616:11)
at execSync (child_process.js:653:13)
at run (/Users/francesco/.nvm/versions/node/v10.15.3/lib/node_modules/react-native-cli/index.js:294:5)
at createProject (/Users/francesco/.nvm/versions/node/v10.15.3/lib/node_modules/react-native-cli/index.js:249:3)
at init (/Users/francesco/.nvm/versions/node/v10.15.3/lib/node_modules/react-native-cli/index.js:200:5)
at Object.<anonymous> (/Users/francesco/.nvm/versions/node/v10.15.3/lib/node_modules/react-native-cli/index.js:153:7)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12) }
My stack is:
- node: 10.15.3
- npm: 6.4.1
- yarn: 1.16.0
- react-native-cli: 2.0.1
Solution 1:[1]
It's better to use React-native 0.57 version for better stability and make sure you have node modules greater than version 10 and correct environmental variables
react-native init ProjectName --version [email protected]
Solution 2:[2]
If your $ node -v is below 12, update to 12 or newer.
Solution 3:[3]
This version works for me as of May 2022.
npx react-native init deeplinktest --version 0.67.4
Solution 4:[4]
try with react-native init YourProjectName
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Arjun Ramdas |
| Solution 2 | Aleem Isiaka |
| Solution 3 | Christopher Chalfant |
| Solution 4 | Erman Tepe |
