JavaScript Asynchronous Programming with JavaScript Understanding Promises Create a Promise

Receiving an error in workspace console. Cannot find module.

const breakfastPromise = new Promise( (resolve, reject) => {
  setTimeout(() => {       
             }, 3000);

Below is the error

Error: Cannot find module '/home/treehouse/workspace/promises-breakfast.js'

2 Answers

This error baffled me too, until I belatedly realized I had to add the directory the file resides in:

node js/promises-breakfast.js

Bec Asmar
Bec Asmar
3,226 Points

Thanks Steven!

I 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.