Setting up a work environment and npm can't find the lessons modules

Link to the Lesson

There’s basically nothing to the code, so I know the code isn’t the issue, and it does work in the codecademy learning environment, but I need to know how to do it on my pc eventually and if I’m not finding the answer now then I’m not gonna find it 6 months from now.

I’ve installed node.js, npm, and lodash into the environment, but when I try to run the file (node _.js) it returns with:

Error: Cannot find module ‘E:\Documents\GitHub\work-environment_.js’
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {

I’ve tried updating to the latest npm, uninstalling and reinstalling, clearing cache, deleting node_modules and package-lock.json. None of these have made any difference.

It seems to be that the directory path is the issue. The file is located in


but it appears you are trying to run if from


Try to change directory into the lodash directory before running it and see if you can get it to work

no no, it just looks like it. _.js is actually 1 directory up from lodash

Well if you go to any directory and type:

node not_a_file.js

Then you will see the same error msg due to a non-existent file. So I would still consider that you could be in the wrong directory. It appeared that way on your screenshot of VS-Code although the error msg “Cannot find module” can sound a bit confusing when it’s due to a simple missing js-file.

omfg you’re right, I was looking at it the complete wrong way. Wow I feel sooo stupid!

1 Like