0

i have some problem to add mongodb, my git is:

https://github.com/yoavshtainer/NodeWebpackTest

my error is:

cannot find module './MongoDB'

i'm using windows 10 with vue-cli and webpack.

my package:

"dependencies": {
    "mongodb": "^2.2.24",
    "vue": "^2.1.10",
    "vue-material": "^0.7.1",
    "vue-resource": "^1.2.0",
    "vue-router": "^2.2.0"
  },

i check my package.json and mongo in it and try to change the path, but nothing works.

1
  • surely it should be require('mongodb'), why are you giving it a relative path to the src directory - there is no mongodb in the src directory Commented Feb 15, 2017 at 9:14

2 Answers 2

1

Module './MongoDB' is saying find the MongoDB.js in the src directory of your folder. But you haven't got one in there.

If you are referring to a module in the packages.json then you don't use relative paths, a.k.a ./, just use the name

require('mongodb');
Sign up to request clarification or add additional context in comments.

1 Comment

thank you! i found my problem with your answer, i forgot to add my MongoDB.js... so this was my problem...
0

I forgot to add my MongoDB.js, this was the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.