Hello! I’m running into several issues with launching an app, written in node.js, whose files I keep on Github. I would really appreciate any insight!
I have two repos on Github for an app (one that theoretically already works–its code is open source–and one where I am testing edits to that open source code). But when I try to launch an app, I just get a confirmation that a NodeJS app was detected. How do you specify which repo you want to launch an app with?
I also get a message that “Your Node app doesn’t define a start script in package.json.” However, there is a line in the file package.json that defines a start script file. Is this something where the grammar needs to be edited so fly.io recognizes it?
Launching a new app creates a fly.toml and a Dockerfile in my local computer’s library. Do I need to move these files to Github as well for the app to successfully deploy?
Is this package.json in the same directory as you are running fly launch?
You can deploy directly from your local computer. Simply run fly deploy. In fact, I would recommend that you get this working before exploring automating deployment with Github.
Certainly! It is this one (for good measure, here are the downloaded, unedited files on my Github).
I used to have it successfully self-hosted on Heroku thanks to online tutorials (I’m not any kind of developer) but have been struggling to get things up and running on fly.
Is this package.json in the same directory as you are running fly launch ?
I am not sure, I am not setting any kind of directory before I run fly launch. The files for the app are not on my local computer after I transferred them to Github, but thanks to this question I just found I have several other files called “package.json” in my library that seem to be associated with other Github repos that I don’t recognize (strange…). It seems like fly was reading one of these files instead.
In fact, I would recommend that you get this working before exploring automating deployment with Github.
Sounds good! I had mistakenly assumed that since I linked my fly account with Github, that it would automatically pull from repos there like Heroku did. Ultimately it would be great to deploy from Github so the app can stay responsive even when I shut down my computer, but it makes sense to figure things out locally first.
I have tried running fly deploy in the past, but ran into an error where it could not access my Trash files (???) and stopped. That can possibly be overcome by re-downloading the source code, setting the directory to its folder, and trying again? If yes how would I go about setting a directory before using fly launch?
Thanks so much for your help so far, I’ve already gotten farther just now than I have in the past week!
Did you run that from the terminal in a folder you had previously deleted? Because thats how I would imagine that would happen.
Not sure, I just opened my terminal and immediately after setting up flyctl and logging into my account, ran fly launch, I don’t know how to tell it to look in any particular directories so if I asked it to open something in Trash it was purely by accident haha. After that happened I tried clearing my Trash and it still gave me an error about not being able to access Trash so I’m not sure if the issue will come up again.
Thank you for the link to how to get it running through Github!! That will be super helpful once I get this working locally!
Hello all, I still need some help with figuring out how to set a directory before fly launching. How do I “run this command from the source directory of your project,” as quoted from the tutorial? I created a folder where all the code is stored now, but I don’t know what to write in the terminal to tell it to look at that source directory (if I’m using the terms right). Sorry for such a basic question! I’ve tried googling it but nothing that looks right is coming up for Macs.
You can use the cd (change directory) and pwd (print working directory) commands to navigate the file system in your Terminal on Mac. Also ~ means “your home directory” and .. means “up a level”.
For example:
➜ ~ pwd
/Users/aaron
➜ ~ cd Desktop
➜ Desktop pwd
/Users/aaron/Desktop
➜ Desktop cd ../Downloads
➜ Downloads pwd
/Users/aaron/Downloads
➜ Downloads cd ../..
➜ /Users pwd
/Users
➜ /Users cd ~
➜ ~ pwd
/Users/aaron
You can also type cd (including the space), then drag and drop a folder onto your terminal window. The full absolute path of your folder will populate, then just press “return” to go to that folder.
For example:
➜ ~ cd /Applications
➜ /Applications ls -l
total 0
drwxr-xr-x@ 3 root wheel 96 Dec 31 08:48 Bitwarden.app
drwxrwxr-x@ 3 aaron admin 96 Dec 31 08:49 Brave Browser.app
drwxr-xr-x@ 3 aaron admin 96 Dec 11 13:46 Firefox.app
drwxr-xr-x@ 3 aaron admin 96 Nov 13 16:01 Google Chrome.app
drwxr-xr-x@ 3 root wheel 96 Nov 25 22:23 Messenger.app
drwxr-xr-x@ 3 root wheel 96 Dec 3 14:29 Numbers.app
drwxr-xr-x@ 3 root wheel 96 Dec 3 14:30 Pages.app
drwxr-xr-x@ 3 aaron staff 96 Dec 4 19:57 Rectangle.app
lrwxr-xr-x@ 1 root wheel 54 Dec 15 08:43 Safari.app -> ../System/Cryptexes/App/System/Applications/Safari.app
drwxr-xr-x@ 3 aaron admin 96 Nov 11 2020 Skitch.app
drwxr-xr-x@ 3 root wheel 96 Nov 29 20:49 Slack.app
drwxr-xr-x 3 root wheel 96 Dec 15 08:43 Utilities
drwxr-xr-x 3 aaron staff 96 Dec 1 10:39 Visual Studio Code.app
drwxr-xr-x@ 3 aaron staff 96 Dec 30 10:56 iTerm.app
drwxr-xr-x@ 3 root wheel 96 Nov 25 12:13 zoom.us.app
In this case I dragged the applications folder on, I didn’t type /Applications manually.
Thank you SO much for such a detailed response! I’m not sure why something this basic wasn’t coming up on google but this helped me tremendously. I used the dragging method and pwd to check and it worked!! Running into new errors now of course but as I believe they are coming from a different source and not Fly I think I’m good now!
Thanks so much again (and to rubys and atridad too)!