thecodingmachine / react-native-boilerplate

A React Native template for building solid applications 🐙, using JavaScript 💛 or Typescript 💙 (you choose).
https://thecodingmachine.github.io/react-native-boilerplate/
MIT License
4.76k stars 867 forks source link

[BUG]: Error resolving dependencies on install #320

Closed b1ek closed 1 year ago

b1ek commented 1 year ago

react-native environment setup

Description

Error:

THE TYPESCRIPT VERSION 📘

- 📚 If you need to read more about this boilerplate : https://thecodingmachine.github.io/react-native-boilerplate/
- 🤕 If you have some troubles : https://github.com/thecodingmachine/react-native-boilerplate/issues
- ⭐ If you love this boilerplate, give us a star, you will be a ray of sunshine in our lives :) https://github.com/thecodingmachine/react-native-boilerplate
× Installing dependencies
error Error: Command failed: npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: blekschedule@0.0.0
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR!   react@"18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || ^17.0.0" from react-native-flipper@0.156.0
npm ERR! node_modules/react-native-flipper
npm ERR!   react-native-flipper@"^0.156.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\bleki\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\bleki\AppData\Local\npm-cache\_logs\2022-10-05T23_05_23_999Z-debug-0.log

The complete log:

0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
1 info using npm@8.15.0
2 info using node@v16.17.1
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\Users\blek\Documents\app\.npmrc Completed in 0ms
10 timing config:load:project Completed in 3ms
11 timing config:load:file:C:\Users\blek\.npmrc Completed in 0ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:C:\Users\blek\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 12ms
19 timing npm:load:configload Completed in 12ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm install
23 verbose argv "install"
24 timing npm:load:setTitle Completed in 1ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 2ms
27 verbose logfile logs-max:10 dir:C:\Users\blek\AppData\Local\npm-cache\_logs
28 verbose logfile C:\Users\blek\AppData\Local\npm-cache\_logs\2022-10-05T23_05_23_999Z-debug-0.log
29 timing npm:load:logFile Completed in 21ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 37ms
33 timing arborist:ctor Completed in 0ms
34 silly logfile start cleaning logs, removing 2 files
35 silly logfile done cleaning log files
36 timing arborist:ctor Completed in 0ms
37 timing idealTree:init Completed in 62ms
38 timing idealTree:userRequests Completed in 0ms
39 silly idealTree buildDeps
40 silly fetch manifest @react-native-async-storage/async-storage@1.17.7
41 http fetch GET 200 https://registry.npmjs.org/@react-native-async-storage%2fasync-storage 1387ms (cache revalidated)
42 silly fetch manifest react-native@0.69.3
43 http fetch GET 200 https://registry.npmjs.org/react-native 14ms (cache hit)
44 silly fetch manifest react@18.0.0
45 http fetch GET 200 https://registry.npmjs.org/react 186ms (cache revalidated)
46 silly fetch manifest @react-native-masked-view/masked-view@0.2.7
47 http fetch GET 200 https://registry.npmjs.org/@react-native-masked-view%2fmasked-view 846ms (cache revalidated)
48 silly fetch manifest @react-navigation/bottom-tabs@6.3.2
49 http fetch GET 200 https://registry.npmjs.org/@react-navigation%2fbottom-tabs 740ms (cache revalidated)
50 silly fetch manifest @react-navigation/native@6.0.11
51 http fetch GET 200 https://registry.npmjs.org/@react-navigation%2fnative 1241ms (cache revalidated)
52 silly fetch manifest react-native-safe-area-context@4.3.1
53 http fetch GET 200 https://registry.npmjs.org/react-native-safe-area-context 370ms (cache revalidated)
54 silly fetch manifest react-native-screens@3.15.0
55 http fetch GET 200 https://registry.npmjs.org/react-native-screens 368ms (cache revalidated)
56 silly fetch manifest @react-navigation/stack@6.2.2
57 http fetch GET 200 https://registry.npmjs.org/@react-navigation%2fstack 429ms (cache revalidated)
58 silly fetch manifest react-native-gesture-handler@2.5.0
59 http fetch GET 200 https://registry.npmjs.org/react-native-gesture-handler 384ms (cache revalidated)
60 silly fetch manifest @reduxjs/toolkit@1.8.3
61 http fetch GET 200 https://registry.npmjs.org/@reduxjs%2ftoolkit 365ms (cache revalidated)
62 silly fetch manifest react-redux@8.0.2
63 http fetch GET 200 https://registry.npmjs.org/react-redux 195ms (cache revalidated)
64 silly fetch manifest @types/react@^16.8 || ^17.0 || ^18.0
65 http fetch GET 200 https://registry.npmjs.org/@types%2freact 213ms (cache revalidated)
66 silly fetch manifest @types/react-dom@^16.8 || ^17.0 || ^18.0
67 http fetch GET 200 https://registry.npmjs.org/@types%2freact-dom 206ms (cache revalidated)
68 silly fetch manifest react-dom@^16.8 || ^17.0 || ^18.0
69 http fetch GET 200 https://registry.npmjs.org/react-dom 204ms (cache revalidated)
70 silly fetch manifest react@^18.2.0
71 silly fetch manifest redux@^4
72 http fetch GET 200 https://registry.npmjs.org/redux 227ms (cache revalidated)
73 silly fetch manifest i18next@21.8.14
74 http fetch GET 200 https://registry.npmjs.org/i18next 199ms (cache revalidated)
75 silly fetch manifest prop-types@15.8.1
76 http fetch GET 200 https://registry.npmjs.org/prop-types 186ms (cache revalidated)
77 silly fetch manifest react-i18next@11.18.3
78 http fetch GET 200 https://registry.npmjs.org/react-i18next 383ms (cache revalidated)
79 silly fetch manifest react-native-flipper@0.156.0
80 http fetch GET 200 https://registry.npmjs.org/react-native-flipper 406ms (cache revalidated)
81 silly fetch manifest react@^16.8.0 || ^17.0.0
82 timing idealTree Completed in 8876ms
83 timing command:install Completed in 8881ms
84 verbose stack Error: unable to resolve dependency tree
84 verbose stack     at Arborist.[failPeerConflict] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1428:25)
84 verbose stack     at Arborist.[loadPeerSet] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1394:34)
84 verbose stack     at async Arborist.[buildDepStep] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:976:11)
84 verbose stack     at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:218:7)
84 verbose stack     at async Promise.all (index 1)
84 verbose stack     at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:154:5)
84 verbose stack     at async Install.exec (C:\Program Files\nodejs\node_modules\npm\lib\commands\install.js:145:5)
84 verbose stack     at async module.exports (C:\Program Files\nodejs\node_modules\npm\lib\cli.js:78:5)
85 verbose cwd C:\Users\blek\Documents\app
86 verbose Windows_NT 10.0.19044
87 verbose node v16.17.1
88 verbose npm  v8.15.0
89 error code ERESOLVE
90 error ERESOLVE unable to resolve dependency tree
91 error
92 error While resolving: app@0.0.0
92 error Found: react@18.0.0
92 error node_modules/react
92 error   react@"18.0.0" from the root project
92 error
92 error Could not resolve dependency:
92 error peer react@"^16.8.0 || ^17.0.0" from react-native-flipper@0.156.0
92 error node_modules/react-native-flipper
92 error   react-native-flipper@"^0.156.0" from the root project
92 error
92 error Fix the upstream dependency conflict, or retry
92 error this command with --force, or --legacy-peer-deps
92 error to accept an incorrect (and potentially broken) dependency resolution.
92 error
92 error See C:\Users\blek\AppData\Local\npm-cache\eresolve-report.txt for a full report.
93 verbose exit 1
94 timing npm Completed in 9018ms
95 verbose unfinished npm timer reify 1665011124131
96 verbose unfinished npm timer reify:loadTrees 1665011124134
97 verbose unfinished npm timer idealTree:buildDeps 1665011124198
98 verbose unfinished npm timer idealTree:#root 1665011124198
99 verbose code 1
100 error A complete log of this run can be found in:
100 error     C:\Users\blek\AppData\Local\npm-cache\_logs\2022-10-05T23_05_23_999Z-debug-0.log

To reproduce the error, run npx react-native init App --template @thecodingmachine/react-native-boilerplate



### Version

3.5.1

### On which OS this issue appear on?

- [ ] IOS
- [ ] Android

### Desktop OS

Windows 10 build 19044.2006
JeremyDolle commented 1 year ago

Thanks for the report ! I will work on it

Dumnersm580 commented 1 year ago

have you found out how to fix this by chance?

samsolo-droid commented 1 year ago

I got the same error but by chance it logged this:

√ Downloading template                                                                                                                                                                     
√ Copying template                                                                                                                                                                         
√ Processing template                                                                                                                                                                      
i Executing post init script                                                                                                                                                               
 √ � Using typescript ? (y/N)                                                                                                                                                               

 ... yes                                                                                                                                                                                   
Error: Command failed: yarn add -D @thecodingmachine/rnb-plugin-typescript                                                                                                                 
'yarn' n'est pas reconnu en tant que commande interne                                                                                                                                      
ou externe, un programme ex�cutable ou un fichier de commandes.                                                                                                                            

  at checkExecSyncError (node:child_process:871:11)                                                                                                                                      
  at execSync (node:child_process:943:15)                                                                                                                                                
  at RNBPlugin.apply (C:\Users\samsa\AppData\Local\Temp\rncli-init-template-CXBAvb\node_modules\@thecodingmachine\rnb-toolbox\dist\index.js:45:56)                                       
  at applyPlugin (C:\Users\samsa\AppData\Local\Temp\rncli-init-template-CXBAvb\node_modules\@thecodingmachine\react-native-boilerplate\template\plugins\index.js:22:9)                   
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {                                                                                                        
status: 1,                                                                                                                                                                               
signal: null,                                                                                                                                                                            
output: [                                                                                                                                                                                
 null,                                                                                                                                                                                  
<Buffer >,                                                                                                                                                                             
<Buffer 27 79 61 72 6e 27 20 6e 27 65 73 74 20 70 61 73 20 72 65 63 6f 6e 6e 75 20 65 6e 20 74 61 6e 74 20 71 75 65 20 63 6f 6d 6d 61 6e 64 65 20 69 6e 74 65 ... 70 more bytes>       
],                                                                                                                                                                                       
pid: 11336,                                                                                                                                                                              
stdout: <Buffer >,                                                                                                                                                                       
stderr: <Buffer 27 79 61 72 6e 27 20 6e 27 65 73 74 20 70 61 73 20 72 65 63 6f 6e 6e 75 20 65 6e 20 74 61 6e 74 20 71 75 65 
20 63 6f 6d 6d 61 6e 64 65 20 69 6e 74 65 ... 70 more bytes> 
}             
samsolo-droid commented 1 year ago

I got the same error but by chance it logged this:

√ Downloading template                                                                                                                                                                     
√ Copying template                                                                                                                                                                         
√ Processing template                                                                                                                                                                      
i Executing post init script                                                                                                                                                               
 √ � Using typescript ? (y/N)                                                                                                                                                               

 ... yes                                                                                                                                                                                   
Error: Command failed: yarn add -D @thecodingmachine/rnb-plugin-typescript                                                                                                                 
'yarn' n'est pas reconnu en tant que commande interne                                                                                                                                      
ou externe, un programme ex�cutable ou un fichier de commandes.                                                                                                                            

  at checkExecSyncError (node:child_process:871:11)                                                                                                                                      
  at execSync (node:child_process:943:15)                                                                                                                                                
  at RNBPlugin.apply (C:\Users\samsa\AppData\Local\Temp\rncli-init-template-CXBAvb\node_modules\@thecodingmachine\rnb-toolbox\dist\index.js:45:56)                                       
  at applyPlugin (C:\Users\samsa\AppData\Local\Temp\rncli-init-template-CXBAvb\node_modules\@thecodingmachine\react-native-boilerplate\template\plugins\index.js:22:9)                   
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {                                                                                                        
status: 1,                                                                                                                                                                               
signal: null,                                                                                                                                                                            
output: [                                                                                                                                                                                
 null,                                                                                                                                                                                  
<Buffer >,                                                                                                                                                                             
<Buffer 27 79 61 72 6e 27 20 6e 27 65 73 74 20 70 61 73 20 72 65 63 6f 6e 6e 75 20 65 6e 20 74 61 6e 74 20 71 75 65 20 63 6f 6d 6d 61 6e 64 65 20 69 6e 74 65 ... 70 more bytes>       
],                                                                                                                                                                                       
pid: 11336,                                                                                                                                                                              
stdout: <Buffer >,                                                                                                                                                                       
stderr: <Buffer 27 79 61 72 6e 27 20 6e 27 65 73 74 20 70 61 73 20 72 65 63 6f 6e 6e 75 20 65 6e 20 74 61 6e 74 20 71 75 65 
20 63 6f 6d 6d 61 6e 64 65 20 69 6e 74 65 ... 70 more bytes> 
}             

This error says that yarn is not recognize as a command So I install yarn and after I run the template command again and it worked

samsolo-droid commented 1 year ago

I think it is because you are not using yarn globally in your computer

Try to install yarn globally npm install --global yarn first, Then after run npx react-native init MyApp --template @thecodingmachine/react-native-boilerplate

b1ek commented 1 year ago

have you found out how to fix this by chance?

@Dumnersm580 This was a problem with my npm repositories. Deleting cached repos and full reinstall of npm fixed this for me