Error: getaddrinfo ENOTFOUND '0' when trying to start nuxt dev server - dns

I wanted to start a nuxt dev server with this script in my package.json (my goal is to access the page from my mobile phone to test it):
"dev:host": "nuxt --hostname '0' --port 8000"
I basically copied the line from the nuxt docs (https://nuxtjs.org/docs/2.x/features/configuration#edit-host-and-port), but I get this error when executing the script:
FATAL getaddrinfo ENOTFOUND '0'
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26)
That's weird, because when I edit nuxt.config.js and add a server object with the same properties, it works (at least at my pc, i still can't access the page with my phone although its in the same network, but I guess that's a different problem). Has anyone stumbled across this dns.js error as well?

Replace '0' with 0.0.0.0 (no quotes). It works for me on Windows 11.
"dev:host": "nuxt --hostname 0.0.0.0 --port 80"

Not sure of the issue here since it's working totally fine on my side.
Maybe try with 0.0.0.0.
Also, what is your OS? It's maybe your #nuxt/cli version?
Here is my test repo: https://github.com/kissu/so-nuxt-vimeo
Maybe host one on github and share it to me, that way I may try and see if it's fine on my side or not (will help debugging if it's Nuxt or system related).

Related

Unable to reach localhost:3000/

I'm working on a react application and for testing some services I wrote a node server in my notebook. It seems that from the app and from the browser I cannot point to https://localhost:3000 due to ERR_SSL_PROTOCOL_ERROR.
I just tried doing some actions like reset all SSL certificates, trying different browser but the only result I found it's that I can reach my server from the browser but not via react.
Can someone help me?
Try http://localhost:3000
Just validated with one of my projects to make sure
The dev server doesn't support https
The localhost:3000 should be hit by: "http://localhost:3000"
If that is not working then the port number can be changed.
In REACT, the port number can be changed with:
"start": "set PORT=3006 && react-scripts start"
How are you running the app? Maybe with
set HTTPS=false&&npm start

Error on npm start on Azure - EADDRNOTAVAIL

I'm trying to get a nodejs app running on Azure (which runs perfectly fine on Heroku).
After running npm start on the app, the following error happens:
Error: connect EADDRNOTAVAIL 127.0.0.1 - Local (0.0.0.0:56256)
at internalConnect (net.js:907:16)
at defaultTriggerAsyncIdScope (internal/async_hooks.js:301:12)
at net.js:998:9
at processTicksAndRejections (internal/process/task_queues.js:75:11) {
errno: 'EADDRNOTAVAIL',
code: 'EADDRNOTAVAIL',
syscall: 'connect',
address: '127.0.0.1'
}
I've tried setting various ports which are free, but no matter what, I get this error.
UPDATE
I know that your current program runs normally in Heroku, and it runs very well locally.
But what I want to tell you is that in azure webapp, there is no need to execute the npm start command to start the webapp. After you pass the deployment, you can set the Startup Command in the portal to start your application. For general nodejs projects, the startup command is npx serve -s.
So you said that the execution of npm start produces an error. If you execute this start command in kudu, it is inappropriate.
If an error occurs when running locally, such as connect EADDRNOTAVAIL 127.0.0.1-Local (0.0.0.0:56256), it is recommended that you use netstat -ano|findstr "56256" to check which process uses the port and deal with.
PRIVIOUS
You need to macke sure use process.env.PORT || 3000 in your project. And you need to know, the port in azure webapp just support 80 and 443. So in your project, So in your code, there can only be one PORT value. After deployed, 443 and 80 will work.
And you can run your app perfectly on HeroKu. So I suggest you upload your code to github.
Then you can deploy your webapp by git. And your issue will be solved. If also have error when deploy, you can check the error in Action on git.

Vue application running on Digitalocean times out in browser

First time I try to use a node.js droplet on Digitalocean: I have a vue.js application running on port 8080, but it times out when I try to load the masterpiece in the browser (I don't have a domain so I use the [server IP]:8080 to access it).
I made sure 8080 is open in the firewall (ufw):
Netstat -pln gave the result seen in the screenshot below, a node program is running but nothing is named vue in case that would be required:
Tried export HOST=0.0.0.0 on advice from a friend, but didn't seem to do anything.
Tested curl 127.0.0.1:8080 from the digitalocean console and it works correctly.
The browser error message is err _ connection timed out.
Any tips on how to get this to show in the browser? As I'm not experienced in working with servers please give me step by step instructions. Thanks!

Nodejs in Openshift MongoDB Error

This could probably be very stupid and naive question, but I have tried all my ways to find the solution, but I'm unable to solve. Hope anyone can solve my problem. Thanks in advance.
Recently, I deployed my nodejs application in Open Shift using Mongolab driver for the MongoDB. When I run the application using 'rhc app start -a nodejs', it gives me an ECONNREFUSED error in mongooose.
Error: connect ECONNREFUSED
at errnoException (net.js:905:11)
at Object.afterConnect [as oncomplete] (net.js:896:19)
But, when I SSH into the server, go to $OPENSHIFT_REPO_DIR directory and use npm start, the app works very fine.
I connect to the mongodb by defining the URI as shown
mongoose.connect(process.env.MONGOLAB_URI || 'mongodb://localhost/<dbname>');
I defined the MONGOLAB_URI as an environmental variable in the server.
There would probably be something that I'm missing. But, please bare with this naive.

Unhandled rejection SequelizeConnectionError: connect ENOENT

I am stuck at a point. I am trying to start /connect using command "npm start" but unable to start npm on server.
I am getting this error:
Unhandled rejection SequelizeConnectionError: connect ENOENT
at Handshake._callback (/home/ec2-user/webapps/vactivity/node/vactivity/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:63:20)
at Handshake.Sequence.end (/home/ec2-user/webapps/vactivity/node/vactivity/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
at Protocol.handleNetworkError (/home/ec2-user/webapps/vactivity/node/vactivity/node_modules/mysql/lib/protocol/Protocol.js:358:14)
at Connection._handleNetworkError (/home/ec2-user/webapps/vactivity/node/vactivity/node_modules/mysql/lib/Connection.js:382:18)
at Socket.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:442:13)
Apart from this my website work on nodejs & have nginx server configured on server.
Every thing started when I tried to set apache for adding a wordpress blog website. Since nginx already working on port 80. I was trying to set apache on another port so that everything work and ended up with above error. Now my website is not starting at all.
Edit:
My website is running using nodejs. I needed a wordpress blog website to run along and so i checked if there is a scope for apache on my server.
I found that apache along with nginx service was already running and mysql as well.
nginx is essential to run "adminer", a database management tool
Since nginx and apache was running on same ports, i tried to set apache on another port, other than default port.
After that I restarted apache, stopped mysql, stopped nginx and also stopped node
I used pkill node command for stopping node service.
Then restarted everything but got the above error.
I tried many things, and finally reset everything.
Ever since then I am stuck on this error.
Can anyone help?
I finally figured the problem and solved it.
Connect ENOENT means that system is unable to connect to mysql because its path is not correct.
As mentioned in an approved answer from Connect MySQL with Sequelize
Update your models/index.js file with the mentioned code.
To find you mysql socket path go to file here /etc/mysql/my.cnf ( this path may depend on your server). For my case it was /etc/my.cnf. Here you will find the socket path. Now paste this path to the code above and do npm start.
Problem is resolved. :)

Resources