简体   繁体   中英

cant get './MongoDB' with vue-cli and webpack

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.

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, aka ./ , just use the name

require('mongodb');

我忘了添加我的MongoDB.js,这就是问题所在。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM