What changes do I need to make to my project to host on my own machine?

Hi Glitchers,

not-urgent response sought:

I’ve been using my glitch project, birdybook (a tool to save faculty some brain when they need to get resources from publishers), to learn programming.

This week I’m learning git and using atom. I downloaded the project and have been trying to make sure I know what I’m doing and have at least some initial effort at version control. I’m not concerned about getting stuff out of sync on Glitch right now because it’s obviously a tool built for other purposes.

I’ve had issues here and there with the transfer to my own machine, and I just did a few searches in the forum and couldn’t find the answer to these questions. Some may be custom issues with my own environment but I thought I’d check for any known issues

  1. First, all my api credentials failed. Its like the .env file wasn’t there. Since nothing is extremely serious/private I just moved them into the clientside so I could work on troubleshooting some other stuff, but I guess I don’t know where the process.env.VARIABLES are if they aren’t in the process.env object.

  2. I had a lot of trouble with pug/jade; as I understand it, express loads all the pug I need and so on Glitch pug is not listed on my package.json dependencies, but I ended up succeeding by adding jade to package.json dependencies, though because I was troubleshooting like a noob I’m not 100% sure that’s what fixed it. My thought is, I wonder if there are things going on in my env when I grab express that are different from when Glitch grabs it. and my goal in asking is that in the scenario where there is a known reason that such an undocumented dependency might work in Glitch and not on my machine.

I’m going to keep trying to get it to work – I’ve got pug rendering properly and the Apis mostly working, at least for the “/” route, but some later API calls are currently failing and I’m guessing it’s that env file; I’ll keep looking for answers but my main reason for posting here is that I’d really like to increase my contextual understanding of the space between 0 and Glitch; i.e., the stuff glitch is doing behind the scenes, so I can take projects to the next level.

John Gilmore, Vancouver Washington

Hi John,

Thanks for the thoughtful questions!

To run your app locally using a local .env file you can try node-foreman. On your machine you can run:

npm install -g foreman

Then to run your application with the .env file in your app’s directory:

nf run npm start

I’m glad you were able to figure out the Jade/Pug stuff. I think we might have Jade pre-installed in the node_modules folder on Glitch so it might ‘just work’ (not sure if this is a bug or not) but adding the package to your package.json and installing sounds like the right way to do things.

Hope this helps, please let us know if you have any other questions :slight_smile:

1 Like

Cool, thanks! took me a decade to develop healthy google-fu and now I need to work on my npm-fu

this is helpful as it gives me a more surefooted solution. Meanwhile, I ended up finding a helpful answer here that forced me to walk through constructing my own environment with dev, prod, and test environs and shell exports and such … it happened to be right in the sweet spot of cognitive load where I learned a lot from it and wasn’t ever totally lost…

1 Like

and for the record, I officially got my whole thing working locally today so Wahoo!

(vid just shows me loading it at localhost:8080):