1

I have folowing directory structure:

--app
  -- test
    -- server.js
  -- app.js

I try to call function in app.js which exports from server.js, i do:

var server = require("test/server");

But get error:

Error: Cannot find module 'test/server'

How can i include it correctly?

Thank you.

4

1 回答 1

4

该路径必须相对于您当前所在的文件。

利用var server = require("./test/server");

于 2013-06-07T18:20:57.477 回答