node-dmx / dmx

DMX controller library for node.js
MIT License
297 stars 95 forks source link

Can not find .json #22

Closed seravifer closed 7 years ago

seravifer commented 7 years ago

It only works when I specify the exact route. I'm running it from:

C:\Users###\AppData\Roaming\npm\node_modules\dmx

with

node dmx-web

module.js:341
    throw err;
    ^
Error: Cannot find module '/etc/dmx-web.json'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (C:\Users\Sergi\AppData\Roaming\npm\node_modules\dmx\dmx-web.js:18:14)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
nucleardreamer commented 7 years ago

It's loading from an absolute URL, so looking in the root/etc folder. You want to either specify it relative, or use __dirname + "/path/to/your.json" to get the absolute path from that script