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

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

Danh Nguyen
Danh Nguyen
9,829 Points

The Variable Challenge - JavaScript Basics course

I am having trouble linking story.js file to index.html file in sublime text 2. In the JavaScript console, the error said this

GET file:///Users/danhnguyen/Desktop/Treehouse_JavaScript_Basics/Stage_02/challenge/Desktop/Treehouse_JavaScript_Basics/Stage_02/challenge/story.js net::ERR_FILE_NOT_FOUND index.html:11

I tried fixing it by doing this

<script src="Stage_02/challenge/story.js"></script>

or this

<script src="challenge/story.js"></script>

I still get the same error.

How do programmers normally save their files or folders on sublime text 2? I feel like there is a specific way to do so.

Jacob Herper
Jacob Herper
91,103 Points

Which path is your index.html in?

3 Answers

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Danh Nguyen

If the index.html and story.js files are both in the same folder then the code that Jacob Herper showed should work:

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

Make sure you include both the opening and closing <script> tags and that the file name is spelled correctly.

One thing about sublime (and other test editors) is that if you have more than one index.html file open, you don't always know which one you're working on -- so double check that the index.html file you're adding the code to is the same one that's inside the challenge folder with the story.js file.

Danh Nguyen
Danh Nguyen
9,829 Points

Yes, it was having more than one index.html file open. Thanks!

Jacob Herper
Jacob Herper
91,103 Points

Try

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

If your index.html file is inside the /challenge/ folder.

Danh Nguyen
Danh Nguyen
9,829 Points

I did that too. I still got the same error.

Failed to load resource: net::ERR_FILE_NOT_FOUND file:///Users/danhnguyen/Desktop/Treehouse_JavaScript_Basics/Stage_02/challenge/story.js

Both of my index.html and story.js file are inside the /challenge/ folder.