1
resposta

[Bug] Erro ao usar comando npx react-native init orgsHooks --version 0.65.1 no mac m1

Estou com um erro que não entendo muito bem ao rodar o comando para iniciar o projeto no inicio do curso React Native: utilizando e criando Hooks

o erro que gerou no terminal foi :

npx react-native init appHooks --version 0.65.1
Need to install the following packages:
  react-native@0.71.7
Ok to proceed? (y) y
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0

               ######                ######               
             ###     ####        ####     ###             
            ##          ###    ###          ##            
            ##             ####             ##            
            ##             ####             ##            
            ##           ##    ##           ##            
            ##         ###      ###         ##            
             ##  ########################  ##             
          ######    ###            ###    ######          
      ###     ##    ##              ##    ##     ###      
   ###         ## ###      ####      ### ##         ###   
  ##           ####      ########      ####           ##  
 ##             ###     ##########     ###             ## 
  ##           ####      ########      ####           ##  
   ###         ## ###      ####      ### ##         ###   
      ###     ##    ##              ##    ##     ###      
          ######    ###            ###    ######          
             ##  ########################  ##             
            ##         ###      ###         ##            
            ##           ##    ##           ##            
            ##             ####             ##            
            ##             ####             ##            
            ##          ###    ###          ##            
             ###     ####        ####     ###             
               ######                ######               


                  Welcome to React Native!                
                 Learn once, write anywhere               

✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Could not locate Gemfile or .bundle/ directory

✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
Error: Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
    at createFromTemplate (/Users/FCxLabs/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/init/init.js:131:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.initialize [as func] (/Users/FCxLabs/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/init/init.js:184:3)
    at async Command.handleAction (/Users/FCxLabs/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js:106:9)
info Run CLI with --verbose flag for more details.
1 resposta

Olá Alysson! Tudo bem?

Pelo erro apresentado, parece que o ambiente iOS não está configurado corretamente. Para resolver esse problema, você pode seguir o guia de configuração do ambiente React Native CLI QuickStart para macOS e iOS, disponível em: https://reactnative.dev/docs/next/environment-setup.

Nesse guia, você encontrará todas as instruções necessárias para configurar corretamente o ambiente iOS no seu Mac M1. Siga as etapas cuidadosamente e certifique-se de ter todas as dependências instaladas corretamente.

Após configurar o ambiente iOS, tente novamente rodar o comando npx react-native init appHooks --version 0.65.1 e veja se o erro persiste.

Caso o problema persista ou surja algum novo erro, fique à vontade para nos informar para que possamos ajudar você da melhor forma possível.

Espero ter ajudado e bons estudos!