Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Piotr Manczak](https://uploads.teamtreehouse.com/production/profile-photos/10607994/micro_20200829_211123.jpg)
Piotr Manczak
Front End Web Development Techdegree Graduate 29,253 Pointsserver setup from nodejs.org not working in console
when a pasted a code from the nodejs.org for setting up a server it does not work in workspaces enviroment, therefore I cannot carry on with this course. Can someone help with this please. Maybe instead of the code from nodejs.org i can use different one or it needs to be modify somehow?
3 Answers
![Travis Alstrand](https://uploads.teamtreehouse.com/production/profile-photos/11658224/micro_travis.jpg)
Travis Alstrand
Data Analysis Techdegree Graduate 49,407 PointsHi Piotr Manczak ,
When I opened up a Workspace for this video this code was already within my app.js
file, was it not in yours?
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
setInterval(function(){
response.write(new Date() + "\n");
}, 1000);
response.end('Hello World\n');
}).listen(3000);
console.log('Server running at http://<workspace-url>/');
This worked just fine for me. When it's running, after running node app.js
in the console, you can click the preview (eye) button up top and select port:3000
.
When I copy/pasted the current code on the node.js website I indeed got an error regarding the import
line they provide now.
I would just use the code above that was provided to continue along with the course and you should be just fine 👍
![Piotr Manczak](https://uploads.teamtreehouse.com/production/profile-photos/10607994/micro_20200829_211123.jpg)
Piotr Manczak
Front End Web Development Techdegree Graduate 29,253 PointsI did not get it when I started, very strange.
![Piotr Manczak](https://uploads.teamtreehouse.com/production/profile-photos/10607994/micro_20200829_211123.jpg)
Piotr Manczak
Front End Web Development Techdegree Graduate 29,253 PointsDear Travis Thank you for your help I will do as instructed.
![Travis Alstrand](https://uploads.teamtreehouse.com/production/profile-photos/11658224/micro_travis.jpg)
Travis Alstrand
Data Analysis Techdegree Graduate 49,407 PointsStrange that it did not appear in yours, sorry about that.
I'm glad this helped out though! 😃
Travis Alstrand
Data Analysis Techdegree Graduate 49,407 PointsTravis Alstrand
Data Analysis Techdegree Graduate 49,407 PointsIf you're still experiencing problems, can you provide a snapshot link to your workspace along with the commands you're trying? That will help us understand how to get you going again 😃