Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation problem #3

Closed
chawaa opened this issue Aug 12, 2020 · 17 comments
Closed

Installation problem #3

chawaa opened this issue Aug 12, 2020 · 17 comments

Comments

@chawaa
Copy link

chawaa commented Aug 12, 2020

Great project, I like it very much. Could you write a more detailed installation tutorial or video tutorial?

@chawaa chawaa changed the title Installation help Installation problem Aug 12, 2020
@Sandermoen
Copy link
Owner

Hello and thank you!
Do you have any specific parts of the setup you are struggling with?

@chawaa
Copy link
Author

chawaa commented Aug 12, 2020

Glad to receive your reply. i'm not good at programming,so I have some strange problems.

  1. Install npm dependencies using npm install. -->There is a warning.

1

After, run npm audit fix to fit them.

2

But there is a new warnings:“1 vulnerability required manual review and could not be updated.”

npm audit for details

3

  1. I uploaded the .env file to the root directory(/www/instaclone), but I cannot see it.

My .env file is filled with the same content as the picture. I don't know if it is correct?

image

Thank you again, author!

  1. npm run dev. There are some warning.

4

and how could I keep running both the backend and the front end?

  1. How do I add a domain name?

image(http://ip:3000)
image

@TimchaStudio
Copy link

@Sandermoen Your project is awesome.

If there is a more detailed installation tutorial, the project will be more popular.

Mastodon is a good example. It has a very detailed installation tutorial.

@TimchaStudio
Copy link

Looking forward to your reply.

@Sandermoen
Copy link
Owner

Sandermoen commented Aug 12, 2020

Glad to receive your reply. i'm not good at programming,so I have some strange problems.

  1. Install npm dependencies using npm install. -->There is a warning.

1

After, run npm audit fix to fit them.

2

But there is a new warnings:“1 vulnerability required manual review and could not be updated.”

npm audit for details

3

  1. I uploaded the .env file to the root directory(/www/instaclone), but I cannot see it.

My .env file is filled with the same content as the picture. I don't know if it is correct?

image

Thank you again, author!

  1. npm run dev. There are some warning.

4

and how could I keep running both the backend and the front end?

  1. How do I add a domain name?

image(http://ip:3000)
image

1. The first error you're getting where it tells you there's a high severity vulnerability is actually a problem with react-scripts (facebook/create-react-app#9469), it's an outdated dependency that they need to update so that one you do not need to worry too much about.

2. The most likely problem with your .env file is that you need to remove the // before the information, here's an example of how it should look

MONGO_URI=mongodb://localhost:27017/instaclone
JWT_SECRET=j2390jf09kjsalkj4r93
CLOUDINARY_API_KEY=fakeCloudinaryApiKey
CLOUDINARY_API_SECRET=fakeClouinaryApiSecret
CLOUDINARY_CLOUD_NAME=fakeCloudinaryCloudName
SMTP_HOST=mail.example.com
SMTP_PORT=587
EMAIL_USERNAME=example@example.com
EMAIL_PASSWORD=Password
HOME_URL=http://localhost:3000
GITHUB_CLIENT_ID=fakeGithubClientId
GITHUB_CLIENT_SECRET=fakeGithubClientSecret

The // is only there to illustrate that it's commented out and that you need to fill in the information.

3. The warning you are getting when running npm run dev is actually partially my fault for not including nodemon in the dependencies in package.json. All you should have to do to remedy this issue is to simply run npm install -g nodemon.

4. The npm run dev command runs both the backend and frontend using concurrently.

5. To add a domain to your server all you have to do is purchase the domain of your liking from a website like Namecheap. You would then have to configure your domain to point to your server's public ip address. I'm sure you can find some good tutorials online if you search around.

If my explaining wasn't good enough or you're still struggling, please let me know!

@Sandermoen
Copy link
Owner

Sandermoen commented Aug 12, 2020

@Sandermoen Your project is awesome.

If there is a more detailed installation tutorial, the project will be more popular.

Mastodon is a good example. It has a very detailed installation tutorial.

Thanks I'm glad you like it!
I hope my last reply will clear up some of your confusion about the installation steps!

@chawaa
Copy link
Author

chawaa commented Aug 13, 2020

Thanks for taking the time to contribute an answer. It’s because of helpful peers like yourself that we’re able to learn together

Your answer solved my first 3 questions.

1. I am not sure if my .env file is correct?

Now my .env

MONGO_URI=mongodb://localhost:27017/www/instaclone
JWT_SECRET=z2390jf09kjsalkj4r94
CLOUDINARY_API_KEY=44522****99
CLOUDINARY_API_SECRET=OnaiGXk7_*****-E5aWsdfHP0V0
CLOUDINARY_CLOUD_NAME=shegusi
SMTP_HOST=smtp.163.com
SMTP_PORT=465
EMAIL_USERNAME=da_vin@163.com
EMAIL_PASSWORD=HDF****
HOME_URL=http://localhost:3000
GITHUB_CLIENT_ID=d36******8fd19e9
GITHUB_CLIENT_SECRET=2cb8d61840c5c******836d8b44495d4e91

my root directory is /www/instaclone. --> MONGO_URI=mongodb://localhost:27017/www/instaclone

JWT_SECRET=z2390jf09kjsalkj4r94 <-- Change to my JWT_SECRET

2. There is “Invalid Host Header” error?

I have configured my domain to point to your server's public ip address.

ping www.heidongwang.top :

1

visit the site http://www.heidongwang.top:3000

3

but visit the site http://ip:3000 -->Jump to the login page.
2

3. http://ip:3000-->https://www.heidongwang.top

How to add ssl certificate? and change the port to 443 ?

4. When I close the command client(xshell), the website cannot run -->How to keep it running when the client is closed

5. Other questions?

Click to enlarge the picture

image

@Sandermoen
Copy link
Owner

Sandermoen commented Aug 13, 2020

1. I am not sure if my .env file is correct?
Your .env file looks mostly fine to me, make sure the MONGO_URI points to the correct mongodb server. If you are running mongodb locally on the same server what you have in your file should be fine. You can also host a mongodb server for free here.

2. There is “Invalid Host Header” error?
I am actually not sure what the direct cause of this problem is, as I am not an expert :). However from what I've gathered from google, it seems that the problem may be related to some firewall settings for your server? I'm sure you can find some good resources online to solve this.

3. How to add ssl certificate? and change the port to 443?
For adding an ssl certificate I recommend trying out Cloudflare. Here's the first tutorial I came across explaining how to use cloudflare for ssl. Another alternative is using Let's Encrypt, though this option requires more configuration on the server side of things. Here's a helpful tutorial for this option. (If you were wondering, the live demo version of the website is hosted with Heroku which automatically applies an ssl certificate).

4. When I close the command client(xshell), the website cannot run -->How to keep it running when the client is closed
A good option for this is using the pm2 library which assures that your process runs forever and restarts if any crashes occur. This daemonizes your process allowing you to exit out of the shell without interrupting the process.

5. Other questions?
The compile warnings you see are a result of missing dependencies from different useEffect hooks. These can safely be ignored for now, if you would like to suppress the warning you could include the below code on the lines where the warning appears.

// eslint-disable-next-line react-hooks/exhaustive-deps

The ip you see is the local ip the project is being served to.
I also see an error where it states that a dependency was compiled against a different node version, if you haven't already I would suggest trying to upgrade your node version if it is outdated.

@chawaa
Copy link
Author

chawaa commented Aug 14, 2020

@Sandermoen I am very satisfied with your reply. Thank you.

@Jishi8088
Copy link

Hello @Sandermoen
Your project is superb...but the screen mentioned is what i am getting even though it is connected to socket properly
Screenshot from 2020-09-25 11-18-31
Screenshot from 2020-09-25 11-09-05

please help as soon as possible

@webkokri
Copy link

webkokri commented Jun 9, 2022

Hello @Sandermoen Your project is superb...but the screen mentioned is what i am getting even though it is connected to socket properly Screenshot from 2020-09-25 11-18-31 Screenshot from 2020-09-25 11-09-05

please help as soon as possible

have you found any solution on it?

@Sandermoen
Copy link
Owner

Sandermoen commented Jun 9, 2022 via email

@webkokri
Copy link

webkokri commented Jun 10, 2022

Hey Sandermoen, you have done a great job. I'm facing a critical issue on installing the software on ubuntu 20 under the nginx. It's working perfectly on the localhost, but whenever installing it to the web server, facing the token=undefined.
Let me share the screenshots. Could you please guide me how to fix this undefined token issue? I have allowed all the required ports on the server but still not able to figure this out.

un
un3
un2

@Sandermoen
Copy link
Owner

Sandermoen commented Jun 10, 2022 via email

@webkokri
Copy link

webkokri commented Jun 10, 2022

I have tried with websocket but no result. I'm a bit surprised to see if I command it "RUN NPM DEV" the token is being generated even on the same server, but whenever I'm trying with "RUN NPM BUILD" it's giving the error specified above. What could be the reason?
Any Idea? @Sandermoen

Screenshot 2022-06-11 042555

@webkokri
Copy link

@Sandermoen I found the issues.
The project is running perfectly fine whenever we are using the command "npm run dev". The auth or socket token is being served without any issue. But whenever we are trying to make a build using "npm run build", it's starting with the error defined above.. or as link shared below;

Could you please help me out or try it on your behalf?
Request URL: http://192.168.18.10:3000/socket.io/?token=undefined&EIO=3&transport=polling&t=O67Ny2q

@Sandermoen
Copy link
Owner

Sandermoen commented Jun 22, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants