psql crash: No such file or directory on m1 Mac - javascript

I was coding and suddenly my mac froze, I couldn't really do much and I force shutdown my mac and after restarting my code won't run saying it can't connect to the database. I checked if psql had any issue and this error message pops up.
"psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory. Is the server running locally and accepting connections on that socket?"
I tried everything to fix even trying to reinstall psql and nothing works. I found a tutorial online saying to check the /usr/local/var/postgres and deleting ostmaster.pid. But I can't find that file anywhere. My /usr/local is also a bit different, I don't have these files var/postgres. I'm freaking out rn :'(

Try checking the environment variables on your pc and check to see if psql is in the path. this make fix the issue

Nvm just fixed it, the file is under homebrew. I deleted it and now everything works again!

Related

How to stop a NodeJs file on Ubuntu server

I paid someone to install a Js script on my server
but when i tried making some changes on scripts/files i just couldnt see the changes on browser
while browsing and googling for like 24 hours i figured out that js scripts should be restarted in order to show the result on browser
and i figured out that in order to start a node js file i should type in terminal
node /dir/example.js
but can someone help me how to refresh/restart it
Iam stuck here like 24 hours
please help
I just want to let you know too that iam using Putty software in order to connect to the ubuntu server, ubuntu version is 20.04
EDIT: you will need an ssh connection to your server with access to a terminal..
Your node.js scripts, if they are on a server, should typically be ran using a process manager such as pm2.
Try to type pm2 list in a terminal. If you see some information you have hit the spot. Just after that run pm2 restart id. id being the number of your process and your changes should be visible.
You can just try this or try your luck with other process managers that run on your server providers. Just read what your server provider recommends for default and usually your previous developer would have used it.

Can't connect to MongoDB server (no error and no messages in the console)

I installed MongoDB on Windows, made a data folder in C: directory and made a db folder inside that data folder, but mongod.exe doesn't want to run. The weirdest thing is that it doesn't give me an error or any message, it just skips to the next line like nothing happened.
Here is a screenshot of the console:
Also when I try to connect the route of mongo.exe to the PhpStorm's Mongo Plugin, PhpStorm doesn't recognize
"C:\Program Files\MongoDB\Server\3.4\bin\mongo.exe" as the path to Mongo Shell.
I installed MongoDB the same way on my other computer that uses Windows 10 and it worked, but on this one that uses Windows 7 it doesn't work.

Server gradually loses connection to MongoDB until it doesn't connect at all

Good Morning and day to all! I hope this makes sense. I was on here last week as I was missing one step to change my app.js file to server.js and got enough help to make it work. I am returning with an new issue that perhaps stem from that one.. Here is what's happening:
I am working on a MEAN app and I've been working as usual typing mongod to have mongoDB running. and i was using npm start because it was advice to me but usually i use nodemon
I've noticed that gradually my server just completely disconnects and I have to manually restart it by typing 'npm start' again. The connection last about 1 minute before it loses it. However now it doesn't connect at all. I think it has something to do with losing connection to MongoDB because I have a console.log for whenever I don't have mongoDB running to remind me.. (and this is the console log that my server spits out)
server.js
require('net').connect(27017, 'locahost').on('error', function(){
console.log("He's name is MongoDB live from port 27017");
process.exit(0);
});
I tried switching back to running it with nodemon while it gives me the impression that it's connected as it doesn't spit out any errors when I update any part of my code or refresh the page, it just spits out the console.log message that I showed above and I have to exit and restart..with npm run devel I have no luck either. (this is not happening in other applications)
Here is a look at my command line with all 3 attempts to connect to the server and notice how it spits out the console.log message.. I refresh my page and it doesn't connect at all anymore. It used to! as I mentioned before but for a minute or so. I hope someone can help me out and point me in the right direction.
using npm start, npm run devel and nodemon
Package.JSON file
So a friend actually pointed something out to me in my server.js code. I don't recall why but the line that reads process.exit(0); is what's causing mongodDB to lose connection with the server. We removed that it and voila! works like a charm. )no idea how that got there.

Express site will not launch

I have used node/Express framework before and I am trying to launch an old webApp that I have used before. Whenever I type ./bin/www nothing happens.. Usually it would say "listening on port 3000" but absolutely nothing happens. I go to the site and there is no connection. No error messages or anything. Does anyone know why this might be happening? I have done it before on another Ubuntu operating system and I am now just trying to launch it on Xubuntu
I am also setting the debug to ./bin/www by inputting:
DEBUG = ./bin/www
EDIT: Found the problem... Apparently I had to install node-legacy instead

Javascript not loading due to net::ERR_CONTENT_LENGTH_MISMATCH

I've got an app that runs fine locally, but barfs in production. (Classic problem, right?)
In production, the JS isn't firing correctly. When I open up the browser console, I see this error:
net::ERR_CONTENT_LENGTH_MISMATCH
When I look in the network tab of Developer Tools, is shows that it failed on a GET request for text/html.
It's a cryptic error. I've only found two other SO posts that even mention is and they're unsolved. (For the interested: first post and second post)
Any idea (1) what it means or (2) how to resolve it?
I am getting Error: net::ERR_CONTENT_LENGTH_MISMATCH
Have a look at your server logs to determine what the real issue is.
For me the problem lay somewhere between nginx and file permissions:
tail -f /usr/local/var/log/nginx/error.log or run nginx -t to determine your conf location, where you could specify a custom log path.
refresh the asset in your browser, eg http://localhost:3000/assets/jquery/jquery.js
You may see something like this in the logs:
"/usr/local/var/run/nginx/proxy_temp/9/04/0000000049" failed (13:
Permission denied) while reading upstream for file xyz
Heres how I fixed:
sudo nginx -s stop
sudo rm -rf /usr/local/var/run/nginx/*
sudo nginx
According to this bug report, that error occurs when an external resource length does not match the Content-Length header given in the response.
This might occur because of a misconfigured server, or (as a stretch) maybe some BOM characters got put into the file, or maybe even different lines endings (are you writing on a DOS machine and deploying to a UNIX machine?) may cause issues.
Hope this helps.
I had a similar issue when trying to interpret JSON results. It turned out that somewhere along the line an odd character landed in the database - in this instance the culprit was "â??". It is not clear how this value arrived in the database, but it is likely related to HTML encoding issues - "Â" character showing up instead of " " Either way, after removing the odd characters, the problem was solved.
I had similar issue
[crit] 6889#0: *14817 open() "/var/cache/nginx/proxy_temp/3/02/0000000023" failed (13: Permission denied) while reading upstream
it was because Nginx worker process were not able to access folder /var/cache/nginx/proxy_temp/ - I just changed the folder permissions and everything started working
I had similar issue developing locally on MAMP and using Chrome as browser. Same problematic websites on the live servers had no such issues. First I thought it was MAMP that was playing around and I checked settings like PHP versions mismatch, apache version etc., reinstalled, but the issue remained. At the end I just switched to using Brave browser (was delaying the shift to Brave for a while anyway) and that fixed it for me.
Hope this helps.

Categories

Resources