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

Charles Sok
Front End Web Development Techdegree Student 8,157 PointsWhy am I getting a console error when I type in this code?
class Pet { constructor(animal, age, breed, sound) { this.animal = animal; this.age = age; this.breed = breed; this.sound = sound; }
speak() { console.log(this.sound); }
}
const ernie = new Pet('dog', 1, 'pug', 'yip yip'); const vera = new Pet('dog', 8, 'border collie', 'woof woof');
ernie.speak(); vera.speak();
error code is
module.js:550
throw err;
^
Error: Cannot find module '/home/treehouse/workspace/Pets.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
My file name is pet.js and I am using node Pet.js to access it.
2 Answers

Charles Sok
Front End Web Development Techdegree Student 8,157 PointsI made a capitalizing error. when I followed the video I didn't capitalize the new folder but when I was working in the console I was following the video and using a capital for the node Pet.js. when I use pet.js as my file folder is lowercase it works as intended.

Steven Parker
240,995 PointsYou say the file name is pet.js (singular), but the error message says something is trying to access "Pets.js" (plural).
Also, the workspace file system is case-sensitive, so "pet.js" would not match "Pet.js".
For future issues, please use a snapshot to allow us to check out the issue fully. Here is a video about sharing a snapshot of your workspace.

Steven Parker
240,995 PointsCongratulations on resolving your own issue.