react-native-community / react-native-template-typescript

👾 Clean and minimalist React Native template for a quick start with TypeScript.
https://www.npmjs.com/package/react-native-template-typescript
MIT License
1.86k stars 397 forks source link

Couldn't find the template.config.js file inside "typescript" template #230

Closed likern closed 2 years ago

likern commented 2 years ago

Expected results

Failed to create project from template

What did you expect to happen?

Succussful RN project with TypeScript creation

Observed results

Снимок экрана от 2021-10-29 18-07-08

Logs

[packages]$ npx react-native init FeeveApp --template typescript
Need to install the following packages:
  react-native
Ok to proceed? (y) y
warn Package @react-native-community/eslint-config has been ignored because it contains invalid configuration. Reason: Cannot find module '@react-native-community/eslint-config/package.json'
Require stack:
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/config/resolveNodeModuleDir.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/releaseChecker/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/runServer.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/start.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/bin.js
warn Package eslint has been ignored because it contains invalid configuration. Reason: Cannot find module 'eslint/package.json'
Require stack:
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/config/resolveNodeModuleDir.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/releaseChecker/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/runServer.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/start.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/bin.js
warn Package eslint-plugin-prettier has been ignored because it contains invalid configuration. Reason: Cannot find module 'eslint-plugin-prettier/package.json'
Require stack:
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/config/resolveNodeModuleDir.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/releaseChecker/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/runServer.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/start.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/bin.js
warn Package eslint-plugin-react-hooks has been ignored because it contains invalid configuration. Reason: Cannot find module 'eslint-plugin-react-hooks/package.json'
Require stack:
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/config/resolveNodeModuleDir.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/releaseChecker/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/runServer.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/start.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/bin.js
warn Package lerna has been ignored because it contains invalid configuration. Reason: Cannot find module 'lerna/package.json'
Require stack:
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/config/resolveNodeModuleDir.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/releaseChecker/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/runServer.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/start.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/bin.js
warn Package typescript has been ignored because it contains invalid configuration. Reason: Cannot find module 'typescript/package.json'
Require stack:
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/config/resolveNodeModuleDir.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/releaseChecker/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/runServer.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/start/start.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js
- /home/me/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/bin.js

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

                  Welcome to React Native!                
                 Learn once, write anywhere               

✔ Downloading template
✖ Copying template
error Error: Couldn't find the "/tmp/rncli-init-template-5vAI2Q/node_modules/typescript/template.config.js file inside "typescript" template. Please make sure the template is valid. Read more: https://github.com/react-native-community/cli/blob/master/docs/init.md#creating-custom-template

Steps to reproduce

  1. Call npx react-native init FeeveApp --template typescript inside monorepo setup in packages/ folder
  2. See failure
likern commented 2 years ago

Doesn't relate to monorepo thing, it just doesn't work at all.

I suggest it's react-native cli bug, but not sure.

emin93 commented 2 years ago

typescript is not the correct template name. Please use the correct template: npx react-native init MyApp --template react-native-template-typescript

likern commented 2 years ago

@emin93 I used command from official documentation npx react-native init AwesomeTSProject --template react-native-template-typescript and it fails the same way.

Снимок экрана от 2021-10-29 19-15-06

erikroznbeker commented 2 years ago

It is some problem with newer yarn versions. if I use yarn "berry" version yarn set version berry I get this error. When I return to "normal" yarn yarn set version classic it works ok.

georgeonofrei commented 1 year ago

seems to be a yarn thing indeed. I've added the --npm flag on the command and the generation worked