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.

1 Answer 1

4

The path must be relative to the file you are currently in.

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

Sign up to request clarification or add additional context in comments.

1 Comment

@0xAX You should select this as the correct answer if it worked and there's nothing else to add.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.