1

Windows 10 64bit

I am trying to play with this repo: https://github.com/mailgun/node-prelaunch

I have Mongodb up and running, along with node.js, but can't seem to get node server to run.

I've installed lodash in the main directory(C:\Users\me\Desktop\myproject\node-prelaunch) where package.js holds dependencies but am still getting thrown these errors:

C:\Users\me\Desktop\myproject\node-prelaunch>node server
module.js:327
    throw err;
    ^

Error: Cannot find module './lodash'
    at Function.Module._resolveFilename     (module.js:325:15)
    at Function.Module._load     (module.js:276:25)
    at Module.require     (module.js:353:17)
    at require     (internal/module.js:12:17)
    at Object.<anonymous>     (C:\Users\me\Desktop\myproject\node-    prelaunch\node_modules\express-    validator\node_modules\lodash\index.js:1:80)
    at Module._compile     (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require     (internal/module.js:12:17)

I've reviewed this link and tried v to follow the steps meeting:cannot find module "lodash"

In the end I guess I'm not exactly sure where the file location of lodash should be installed. Any help is greatly appreciated.

Community
  • 1
  • 1
user2873003
  • 357
  • 4
  • 21

1 Answers1

1

You're importing lodash from the current working directory, instead of the local package index:

require('./lodash')
Error: Cannot find module './lodash'

./lodash is a relative path. It means <current directory>/lodash Try using the name without prefix:

require('lodash')
salezica
  • 74,081
  • 25
  • 105
  • 166