Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error - Cannot find module 'config'

I have mail configuration code in all.js.

Now i am trying to import this in my mail.js service, so i imported the config module as follows :-

mail.js

config = require('config'),

all.js

mailer: {
        auth: {
            user: "XXXXXXX",
            pass: "abc@123"
        }
    }

enter image description here

Gives me error cannot find module, but the module exists i have checked it.

How to solve this?

like image 592
Anup Avatar asked Feb 06 '14 09:02

Anup


2 Answers

I used the following code & it worked :-

config = require('../config/config');
like image 147
Anup Avatar answered Nov 14 '22 18:11

Anup


This also occurs when you don't have the config package installed. You may just need to install the config package

npm i config
like image 33
ebentil Avatar answered Nov 14 '22 17:11

ebentil