这些是我从目录sangam
运行grunt serve命令后得到的语句C:\Users\Rohit\Documents\GitHub\sangam>grunt serve
Running "serve" task
Running "clean:server" (clean) task
Running "env:all" (env) task
Running "concurrent:server" (concurrent) task
Running "injector:scripts" (injector) task
Missing option `template`, using `dest` as template instead
Injecting js files (14 files)
>> Nothing changed
Running "injector:css" (injector) task
Missing option `template`, using `dest` as template instead
Injecting css files (5 files)
>> Nothing changed
Running "wiredep:target" (wiredep) task
Running "autoprefixer:dist" (autoprefixer) task
Running "express:dev" (express) task
Starting background Express server
Debugger listening on port 5858
module.js:327
throw err;
^
Error: Cannot find module 'mongodb/node_modules/bson'
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\Rohit\Documents\GitHub\sangam\node_modules\mongoose\lib\drivers\node-mongodb-native\objectid.js:8:16)
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)
Running "wait" task
>> Waiting for server reload...
Done waiting!
Running "open:server" (open) task
Running "watch" task
Waiting...
运行grunt服务后,我收到了该错误
&#34;找不到模块&m ;; mongodb / node_modules / bson&#39;&#34; ,
打开localhost页面,但是我得到了#34;无法到达此页&#34; ,请帮我这个
答案 0 :(得分:3)
如github-issue所述,请尝试执行以下步骤: -
确保这两个包都是这些版本
&#34; mongodb&#34;:&#34; ^ 2.1.16&#34;, &#34; mongoose&#34;:&#34; ^ 4.4.12&#34;
npm install -g node-gyp
cd /to/your/project-folder
rm -rf node_modules
npm install
也可以尝试: -
在node_modules / mongodb中执行npm install。
希望这会对你有所帮助。
答案 1 :(得分:1)
尝试再次将mongoose 4.2.8
更改为package.json
和npm install
。
它既适用于本地,也适用于heroku。
答案 2 :(得分:0)
一定要做到这一点非常重要:
npm install -g node-gyp
cd /to/your/project-folder
rm -rf node_modules
npm install
答案 3 :(得分:0)
我做了什么 刚删除了node_modules文件夹并运行
npm install
它运作良好。