Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Introducing JavaScript Your First JavaScript Program

Can someone please help me troubleshoot workspaces? The alert and document.write programs are not working.

I'm accessing workspaces via Chrome on a Windows 7 Pro laptop.

I inserted the following code snippets into workspaces.

alert("Hello User");

document.write("<h1>You're going to be a Front-End Engineer someday</h1>");

The result was a redirect to following link: http://port-80-clsmywbsb4.treehouse-app.com/ - I did not receive any alert and an HTML page was not rendered.

I read comments and turned off ad blocker and refreshed workspaces multiple times. The problem persisted.

I tried the same code snippets in the Chrome Dev Tools console and the code executed similar to the way it did in the course video. I received an alert and then an HTML page was rendered with an <h1> element and some text.

The HTML page URL that was rendered via Chrome Dev Tools is http://port-80-clsmywbsb4.treehouse-app.com/, which appears to be the same redirect I got from workspaces. However, what I see on the pages is different i.e. via workspaces, I got a "Index of" page, via the Chrome console I got the expected results (alert and HTML page with <h1> element.

I'm stumped. I can't move forward properly with the track until solve this problem.

Does anyone know a solution to my problem? Is there an alternative to workspaces that I can use to continue the track that will not limit my participation/learning.

Thanks!

George

4 Answers

Hey George,

So it seems like the links you provided run into a dead end, so it's really hard for me to know for sure what led to the bug you encountered. That being said, my first and foremost method for troubleshooting a workspaces problem is to do the following:

  1. Click on the Workspaces link in the left sidebar
  2. Click on the "gear" to the right of the specific Workspace in which you encountered the issue
  3. Click the red "Delete Workspace" in the pop up window
  4. Open a brand new workspaces for the video in which you first encountered the bug

I noticed that this process has a "resetting" effect, much like restarting your computer does. If you still encounter the problem, contact Treehouse Customer Support at help@teamtreehouse.com.

As far as alternative text editors are concerned, Sublime Text is extremely popular, and Brackets is my personal tool of choice because it's front-end oriented, but there are many different flavors to choose from. There are even more technical command-line text editors such as Vim. While Workspaces is certainly a fantastic and robust convenience, having a text editor that can be used offline and independent from the browser is vital. You can easily download the "project files" for Treehouse lessons and work on them in the text editor of your choice.

Bugs are a part of the game - while they can be frustrating, they're unavoidable and ubiquitous in programming. Don't let them deter you from moving forward. Use alternative resources and documentation like the Mozilla Developer Network to find the answers you need to keep the wheels turning.

Best of luck!

Chris

Hi Chris,

Thanks for your response. Your solution worked. I deleted the existing workspace and created a new workspace via the workspace launcher within the video I was watching. I was redirected to a new workspace that was pre-populated with the file from the video. I input the exact same code as previously and the code executed properly.

I remained curious and decided to further investigate my problem. I created the first workspace from scratch (i.e. not using the launcher in the video). I discovered that, for me at least, if I create a workspace outside of the video I'm watching and add a new .js file, the JavaScript code does not execute and I get redirected to a dead end. I created two workspaces one that was set to "any environment" and another that was set to "front-end." In both cases JavaScript did not work.

Code completion worked in the workspace I created from scratch, therefore, I believe I set up them up correctly.

It seems there may be a bug that prevents users from using JavaScript when they create a new workspace outside of the video launcher that pre-populates the workspace for users.

Thanks again for your help!

Best,

George

In the workspace you created from scratch, did you add a script tag to your index.html linking your .js file? It would look something like this...

<script src="fileName.js"></script>

[headslap] No, I didn't add the in-line <script> in the workspace I created from scratch. In fact, I didn't even create an index.html file. For some reason, I assumed the JavaScript would just render a new page by default, since that is what happen when I ran the code in the Chrome Dev Tools console.

I set up the workspace from scratch, with the index.html file and the the linking script, and everything worked fine.

Lesson learned, the hard way. At least the next person that makes this mistake can reference this thread.

Thanks again for your help, Chris.

That worked for me. Thanks!

Zander Curtis
Zander Curtis
10,634 Points

I had this same problem and the reset worked. Thanks Christopher!