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 trialCody Tapp
9,667 PointsReceiving an error in workspace console. Cannot find module.
const breakfastPromise = new Promise( (resolve, reject) => {
setTimeout(() => {
}, 3000);
});
console.log(breakfastPromise);
Below is the error
Error: Cannot find module '/home/treehouse/workspace/promises-breakfast.js'
3 Answers
Steven Vallarsa
6,025 PointsThis error baffled me too, until I belatedly realized I had to add the directory the file resides in:
node js/promises-breakfast.js
Maxwell Jermy
22,419 PointsI know it has been a while since you asked this, but if you still need an answer I believe it is because your console is in the wrong directory. To use node you need to be in the same directory as the js file.
Amy Tomey
12,847 PointsYou can always right click on the file in the tree and select relative path... I download the project files and work in VScode, Sometimes, I have to add a ./ at the beginning of the file's url to make it work.
Bec Asmar
4,403 PointsBec Asmar
4,403 PointsThanks Steven!