LunatiqueCoder / luna

Luna - a React Native + Next.js template. Built with TypeScript :heart:
https://luna-gamma.vercel.app/
MIT License
265 stars 19 forks source link

Template not found error / with workaround #7

Closed mikehardy closed 3 years ago

mikehardy commented 3 years ago

Describe the bug

Hi there! I was unable to use this template with the provided instructions

To Reproduce

Try to install the template using either the default (yarn)


mike@osxvm-spare:~/work/EquityResidences/equityresidences/packages/public-app (main) % npx react-native init MyAppName --template @plaut-ro/luna --npm

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

                  Welcome to React Native!                
                 Learn once, write anywhere               

✖ Downloading template
error Error: Command failed: npm install --save --save-exact @plaut-ro/luna
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@plaut-ro%2fluna - Not found
npm ERR! 404 
npm ERR! 404  '@plaut-ro/luna@*' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

...or npm, neither work:


mike@osxvm-spare:~/work/EquityResidences/equityresidences/packages/public-app (main) % npx react-native init MyAppName --template @plaut-ro/luna --npm

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

                  Welcome to React Native!                
                 Learn once, write anywhere               

✖ Downloading template
error Error: Command failed: npm install --save --save-exact @plaut-ro/luna
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@plaut-ro%2fluna - Not found
npm ERR! 404 
npm ERR! 404  '@plaut-ro/luna@*' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Expected behavior

Successful install

Screenshots

Desktop (please complete the following information):

I did all the troubleshooting about removing global react-native-cli installs etc - they were not there to begin with (I try to never install global packages...) but I did it just to make sure. You never know! It had no effect.

I was able to do it using the git url though:

npx react-native init MyAppName --template https://github.com/plaut-ro/luna --> success!

it also works with --template plaut-ro/luna which I suppose goes right to github as well, without the @

I generally know my way around the react-native command line (e.g., I script install demos for react-native-firebase, which I maintain, all the time - https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh) but I'm always open to learn something new. Maybe I'm missing something here?

mikehardy commented 3 years ago

One more tidbit:

https://github.com/plaut-ro/luna/blob/master/template/android/gradlew - the main gradlew script, is not executable, I had to chmod 755 android/gradlew before yarn android would work

After figuring out how to reference the template and +x'ing the gradle script it all works though! Fantastic, thank you

mikehardy commented 3 years ago

PR #8 posted to clean both those items up

LunatiqueCoder commented 3 years ago

Hello @mikehardy. I am aware of these issues. I moved the repo to plaut-ro and I did not adapt it yet. (Like republishing to npm). I also did not have time to prepare a workflow, but I will take a look at your PR later on, thank you for helping me! :)

LunatiqueCoder commented 3 years ago

I invited you as a maintainer. This is the first package I'm maintaining and I appreciate all the help.

mikehardy commented 3 years ago

Ah cool - happy to collaborate. I put out a call on the react-native Discord server for a typescript template that does react-native-web too and it appeared the only thing that currently worked was expo init followed by eject, which isn't the minimal example I was looking for. This was the first one I found that looked relatively minimal, and the parts where it is not minimal are what (almost?) every app needs: the icons and the navigation.

How would you feel - slowly, over time - about two templates, one that is truly minimal - just typescript + multi-platform, along with this one ? Separately, and also slowly over time, maybe broadening to windows/macos? The multi-platform template with typescript space is pretty lacking at the moment!

Finally - any specific reason not to update things where possible (current react-native / react-native-web, for instance?) I'll give those a try locally but can post a PR if they work. In my experience this usually implies the need to integrate patch-package and some patches in order to be compatible (specific example: this patch is probably needed https://github.com/facebook/create-react-app/pull/11338) but having a template lag behind current implies anyone that uses it is already behind things, which is a shame when things like this https://github.com/facebook/react-native/issues/31941 and this https://github.com/facebook/react-native/issues/31480 happen on react-native 0.65 but are fixed on 0.66

mikehardy commented 3 years ago

I posted about this template on that typescript discord channel, if you're interested https://discord.com/channels/514829729862516747/652683748630069248/903279203326259250

LunatiqueCoder commented 3 years ago

The only reason I also wanted to use react-native-vector-icons is because I found people complaining that they could not make them work for the web. I also chose to implement react-navigation because I think it offers the best web support.

I mainly made this package to help others. You are clearly much more experienced and that's why I instantly gave you all the privileges you might need to improve. Let's bring multi-platform to everyone. 🥳

All your ideas sound great, and they have already been on my mind to be honest. I was going to bump the versions before actually releasing the package. And yes, windows/macos also sounds great. 🤩

LunatiqueCoder commented 2 years ago

@mikehardy I'm sorry, but the discord link is broken for me. 🥺 And I'd like to keep in touch.

mikehardy commented 2 years ago

Oh I see - I investigated and while there are a pile of people in that server it does appear to require an invite. So, I requested one :-)