module.js:491 throw err; ^错误:找不到模块'mangoose'

时间:2017-12-04 11:57:09

标签: node.js mongodb express

我是MEAN.JS的新手,我在运行代码时收到此错误。我没有发现任何错误,但我是初学者,所以我不太了解,这里是代码。我也在这里附上错误。

module.js:491
throw err;
^

Error: Cannot find module 'mangoose'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> 
(/home/rajeev/Documents/practice/nodejs1/contactlist/app.js:2:14)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)

app.js

var express=require('express');
var mongoose=require('mongoose');
var bodyparser=require('body-parser');
var cors=require('cors');
var path=require('path');

var app=express();

//port no
const port=3000;

//testing sever
app.get('/',(req,res)=>{
    res.send('footbar');
});

app.listen(port,()=>{
    console.log('server started at port:'+port);
});

的package.json

  "name": "contactlist",
  "version": "1.0.0",
  "description": "a simple mean application",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "rajeev",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.18.2",
    "cors": "^2.8.4",
    "express": "^4.16.2",
    "mongoose": "^4.13.6"
  }
}

1 个答案:

答案 0 :(得分:2)

应该是 mongoose

var express=require('express');
var mangoose=require('mongoose');