Node.jsとRender

I'm currently working on lecture 251. In this, we're supposed to deploy a sign up page to a cloud hosting.
Since teacher Angela uses Heroku and it's no longer free, I decided to use https://render.com/ as an alternative.

I was following this YouTube video
How to Deploy a Node.js App to Render.com for Free (Heroku Alternative)



1 . Check if the local environment works correctly.
※ MAKE SURE USING SAME VERSION AS RENDER  (detail →Problem 1)

$ npm i express

$ npm i @mailchimp/mailchimp_marketing

$ npm i https      ※ LATEST VERSION IS $ npm i node-https

2 .  Create a new repository

3 . Push to the remote repository

$ git init
$ git branch -M main
$ git add .
$ git commit -m "First Commit"
$ git remote add origingit@github.com:yoriss67/Newsletter-Signup.git
$ git push -u origin main  ( ※ after first push → git push origin main )

  

Problems I had to reach above

1. Error: Cannot find module ‘node:https’

Since I was initially using Node version 19.4.0. BUT Render's default is 14.17.0.

So I had to change the version.
I newly learned that it's better to have a Node.js version manager.
windows = nodist   (🙋‍♀️ME)
Mac = nodebrew

How to install


$ nodist 14.17.0

2. Error:updates were rejected because the remote contains work that you do

Googled and reached this site

Codes introduced in the site

$ git pull origin main

$ git push

And followed what command says

$ git push --set-upstream origin main


3. Error: updates were rejected because the tip of your current branch is behind


stackoverflow : 
“The tip of your current branch is behind its remote counterpart" means that there have been changes on the remote branch that you don’t have locally.”

I interpreted it as I received this error because I had commands previously.
So I created VSCode, Github and Render from scratch and installed the three by command.  => GO BACK TO TOP

$ npm i express

$ npm i @mailchimp/mailchimp_marketing

$ npm i https



この記事が気に入ったらサポートをしてみませんか?