Yeoman grunt无法连接到MongoDB

时间:2017-05-23 23:23:51

标签: node.js mongodb meanjs

我一直在尝试运行Yeoman生成的应用程序,但每次运行命令grunt时,都会遇到同样的错误:

PS C:\Users\Aiden\yo\mean> grunt
Loading "grunt-karma.js" tasks...ERROR
>> TypeError: Cannot read property 'prototype' of undefined
>> Local Npm module "grunt-node-inspector" not found. Is it installed?

Running "env:dev" (env) task

Running "sass:dist" (sass) task
Warning:
You need to have Ruby and Sass installed and in your PATH for this task to 
work.
More info: https://github.com/gruntjs/grunt-contrib-sass
 Used --force, continuing.

Running "less:dist" (less) task

Running "jshint:all" (jshint) task
>> 87 files lint free.

Running "csslint:all" (csslint) task
>> 2 files lint free.

Running "mkdir:upload" task

Running "copy:localConfig" (copy) task


Running "concurrent:default" (concurrent) task
    Loading "grunt-karma.js" tasks...ERROR
    >> TypeError: Cannot read property 'prototype' of undefined
    Loading "grunt-karma.js" tasks...ERROR
    >> TypeError: Cannot read property 'prototype' of undefined
    >> Local Npm module "grunt-node-inspector" not found. Is it installed?
    >> Local Npm module "grunt-node-inspector" not found. Is it installed?

    Running "watch" task
    Waiting...

    Running "nodemon:dev" (nodemon) task
    [nodemon] 1.11.0
    [nodemon] to restart at any time, enter `rs`
    [nodemon] watching: server.js config/**/*.js modules/*/server/**/*.js
    [nodemon] starting `node --debug server.js`
(node:8744) DeprecationWarning: node --debug is deprecated. Please use node --inspect instead.
Debugger listening on 127.0.0.1:5858


Could not connect to MongoDB!
{ MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
    at Pool.<anonymous> (C:\Users\Aiden\yo\mean\node_modules\mongoose\node_modules\mongodb-core\lib\topologies\server.js:328:35)
    at emitOne (events.js:96:13)
    at Pool.emit (events.js:191:7)
    at Connection.<anonymous> 
(C:\Users\Aiden\yo\mean\node_modules\mongoose\node_modules\mongodb-
core\lib\connection\pool.js:274:1
2)
         at Object.onceWrapper (events.js:293:19)
         at emitTwo (events.js:106:13)
         at Connection.emit (events.js:194:7)
         at Socket.<anonymous> 
(C:\Users\Aiden\yo\mean\node_modules\mongoose\node_modules\mongodb-
core\lib\connection\connection.js:177
:49)
        at Object.onceWrapper (events.js:293:19)
        at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at emitErrorNT (net.js:1279:8)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
  name: 'MongoError',
  message: 'failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]' }
     C:\Program Files\nodejs\node.exe: src\debug-agent.cc:147: Assertion `(err) == (0)' failed.
    [nodemon] app crashed - waiting for file changes before starting...

我已经尝试过关于这个问题我能找到的每一个解决方案,包括使用NPM安装至少十几个不同的软件包。我很茫然。有什么想法吗?

0 个答案:

没有答案