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 trialJames Ranish
1,801 Points"Cannot find module" error in Random Array Index
I ran "node script.js" as-is and got
Error: Cannot find module ''/home/treehouse/workspace/script.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
I tried commenting out all the lines of code except
const twelveSidedDie = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
and still get the error.
When I right-click on index.html (in Chrome), the choices are
New File
New Folder
Upload File
Rename
Delete
Refresh
1 Answer
KRIS NIKOLAISEN
54,971 PointsI did a search and this seems like the same project. If so in loading the snapshot the script.js
file is in folder js
so you would have to run node js/script.js