By Phong Duong
I installed NodeJS by following link: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-centos-7 But when I test my nodejs project HelloWorld, the system show errors: File hello.js: var http = require(‘http’); http.createServer(function (req, res) { res.writeHead(200, {‘Content-Type’: ‘text/plain’}); res.end(‘Hello World\n’); }).listen(8080,‘http://10.132.36.167’); console.log(‘Server running at http://10.132.36.167’); System show error: Server running at http://10.132.36.167 events.js:174 throw er; // Unhandled ‘error’ event ^ Error: getaddrinfo ENOTFOUND http://10.132.36.167 at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26) Emitted ‘error’ event at: at GetAddrInfoReqWrap.doListen [as callback] (net.js:1448:12) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:17) How can I fix this? Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Greetings!
Thanks for posting the question here so that others can learn from it as well. I believe the problem is with this line:
}).listen(8080,'http://10.132.36.167');
I believe it should instead read:
}).listen(8080,'10.132.36.167');
Just removing the protocol and putting the address only there.
Jarland
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.