我有npm开始出现问题,有人可以帮帮我吗?

时间:2016-02-07 07:55:40

标签: node.js mongodb npm

我最近遇到了这个问题并且使用了像npm install这样的命令,重新启动但没有运气,有人能帮助我吗?这开始于我点击ctrl -c然后点击npm start重新加载服务器,然后我遇到了所有这些错误。我试着寻找答案,但没有运气。

    Alexs-MacBook-Air:1app alexjurado$ npm start

> 1app@0.0.0 start /Users/alexjurado/1app
> node ./bin/www

module.js:328
    throw err;
    ^

Error: Cannot find module 'mongodb'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/alexjurado/1app/app.js:7:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm  v3.7.1
npm ERR! code ELIFECYCLE
npm ERR! 1app@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 1app@0.0.0 start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the 1app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs 1app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls 1app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/alexjurado/1app/npm-debug.log

1 个答案:

答案 0 :(得分:1)

你的package.json中有mongodb依赖吗? npm install将安装您在依赖项中放置的模块

"dependencies": 
  {
    "express":      "~4.13.4",
    "mongodb":      "~2.1.5"

    .......
  }

更新您的package.json并运行npm install