节点JS - 急性无法找到模块错误

时间:2015-09-01 18:20:42

标签: node.js express

当我尝试执行此代码时,它会给出一个令我困惑的错误。

var express = require('express');
var app = express();
var mongoose = require('mongoose');
var validator = require('node-mongoose-validator');
var bodyParser = require('body-parser')
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }))

var routes = require('./routes');
var route_add_user = require('./routes/add_user');

错误读取

module.js:338
    throw err;
    ^
Error: Cannot find module './routes'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\nodefiles\new\server.js:9:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

请帮我解决这个问题。最有可能的是我错过了一些有问题的东西,这是基本的,但也许我忽略了它。

0 个答案:

没有答案