테스트 사이트 - 개발 중인 베타 버전입니다

node.js오류 다시 올립니다 ㅜㅜ 이미지깨짐으로인해 채택완료

플로리아 9년 전 조회 4,911

여기다 질문해도 되는지 모르겠지만.. 그래도 여기는 유능한 분들이 많아서.. 올려 보겠습니다.

 

 



이런 오류가 나오네요..
대충 파일을 읽을수 없다는거 같은데.. 파일 명은 config.json 과 config_local.json-dist 입니다.. config_local.json-dist같은경우 config_local.json로 변경후 해봐도 그대로네요 ㅜㅜ 
참고로 설치 중인 건broswer quset 라는 게임입니다. 모듈 설치를 따로 또해야되는게 있는건지 아니면
다른 설정을 해야되는건지.. 알려주세요


참고로 main.js 소스는 밑 참고 해주세요

</span></div><div class="NHN_Writeform_Main" style="color: rgb(72, 72, 72); font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px; font-family: dotum;"><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">var fs = require('fs');</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">var Metrics = require('./metrics');</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">var ProductionConfig = require('./productionconfig');</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">var _ = require('underscore');</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">function main(config) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var Log = require('log');</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    switch(config.debug_level) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        case "error":</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            log = new Log(Log.ERROR); break;</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        case "debug":</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            log = new Log(Log.DEBUG); break;</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        case "info":</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            log = new Log(Log.INFO); break;</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    };</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var production_config = new ProductionConfig(config);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    if(production_config.inProduction()) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        _.extend(config, production_config.getProductionSettings());</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var ws = require("./ws");</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var WorldServer = require("./worldserver");</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var server = new ws.WebsocketServer(config.port, config.use_one_port, config.ip);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var metrics = config.metrics_enabled ? new Metrics(config) : null;</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var worlds = [];</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var lastTotalPlayers = 0;</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var DatabaseSelector = require("./databaseselector");</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var checkPopulationInterval = setInterval(function() {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        if(metrics && metrics.isReady) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            metrics.updateWorldCount();</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            metrics.getTotalPlayers(function(totalPlayers) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                if(totalPlayers !== lastTotalPlayers) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                    lastTotalPlayers = totalPlayers;</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                    _.each(worlds, function(world) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                        world.updatePopulation(totalPlayers);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                    });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    }, 1000);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    log.info("Starting BrowserQuest game server...");</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var selector = DatabaseSelector(config);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    databaseHandler = new selector(config);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    server.onConnect(function(connection) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        var world; // the one in which the player will be spawned</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        var connect = function() {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                if(world) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                    world.connect_callback(new Player(connection, world, databaseHandler));</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            };</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        if(metrics) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            metrics.getOpenWorldCount(function(open_world_count) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                // choose the least populated world among open worlds</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                world = _.min(_.first(worlds, open_world_count), function(w) { return w.playerCount; });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                connect();</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        else {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            // simply fill each world sequentially until they are full</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            world = _.find(worlds, function(world) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                return world.playerCount < config.nb_players_per_world;</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            world.updatePopulation();</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            connect();</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    server.onError(function() {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        log.error(Array.prototype.join.call(arguments, ", "));</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var onPopulationChange = function() {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        metrics.updatePlayerCounters(worlds, function(totalPlayers) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            _.each(worlds, function(world) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">                world.updatePopulation(totalPlayers);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        metrics.updateWorldDistribution(getWorldDistribution(worlds));</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    };</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    _.each(_.range(config.nb_worlds), function(i) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        var world = new WorldServer('world'+ (i+1), config.nb_players_per_world, server, databaseHandler);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        world.run(config.map_filepath);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        worlds.push(world);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        if(metrics) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            world.onPlayerAdded(onPopulationChange);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            world.onPlayerRemoved(onPopulationChange);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    server.onRequestStatus(function() {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        return JSON.stringify(getWorldDistribution(worlds));</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    if(config.metrics_enabled) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        metrics.ready(function() {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            onPopulationChange(); // initialize all counters to 0 when the server starts</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    process.on('uncaughtException', function (e) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        // Display the full error stack, to aid debugging</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        log.error('uncaughtException: ' + e.stack);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">}</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">function getWorldDistribution(worlds) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    var distribution = [];</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    _.each(worlds, function(world) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        distribution.push(world.playerCount);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    return distribution;</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">}</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">function getConfigFile(path, callback) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    fs.readFile(path, 'utf8', function(err, json_string) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        if(err) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            console.info("This server can be customized by creating a configuration file named: " + err.path);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            callback(null);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        } else {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            callback(JSON.parse(json_string));</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">}</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">var defaultConfigPath = './server/config.json';</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">var customConfigPath = './server/config_local.json';</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">process.argv.forEach(function (val, index, array) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    if(index === 2) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        customConfigPath = val;</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">});</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;">
</div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">getConfigFile(defaultConfigPath, function(defaultConfig) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    getConfigFile(customConfigPath, function(localConfig) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        if(localConfig) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            main(localConfig);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        } else if(defaultConfig) {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            main(defaultConfig);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        } else {</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            console.error("Server cannot start without any configuration file.");</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">            process.exit(1);</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">        }</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">    });</span></div><div class="NHN_Writeform_Main" style="color: rgb(0, 0, 0); font-size: 12px; letter-spacing: normal; line-height: 18px;"><span style="font-size: 8pt;">});</span></div><div><span style="font-size: 8pt;">
댓글을 작성하려면 로그인이 필요합니다.

답변 9개

채택된 답변
+20 포인트
9년 전

npm install or update라고 치는 것이 아니고..

 

npm install 해보시던지..

 

아니면 npm update 둘중에 하나만 하라는 이야기입니다.

 

노드 책을 보시고 시작하라고 권하고 싶네요..

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

플로리아
9년 전
해보았죠;;
근데 안되서;; npm install or update 까지도 처보았습니다 ㅜㅜ
플로리아
9년 전
아 제가 멍청했네요 ㅜㅜ 구문 오류라고 뻔히 나오는데;; 확인도 안하고 질문부터 해버렸네요;;
그 node.js bcrypt 모듈이 없는데. 어디서 구해야 될까요;; npm으로 설치하면 에러가 떠서;;

댓글을 작성하려면 로그인이 필요합니다.

9년 전

npm install bcrypt 하시면 되고요..

 

없다고 하는 모듈은 대부분 위와 같은 형식으로 설치하시면 됩니다.

 

대부분의 연관된 파일은 packages.json에 들어가 있습니다. (없다면 여기다 추가)

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

플로리아
9년 전
bcrypt는 node-bcrypt로 변경해서 설치했구 다른 자바스크립트 파일들도 수정했구요 근데 다른 오류가 생기네요 ㅜㅜ

댓글을 작성하려면 로그인이 필요합니다.

 

이렇게 나오네요;;
그리고 마지막 혹시몰라 node server/js/main.js 실행까지 해봤지만.. 이렇게 나와요 ㅜㅜ
 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

9년 전

모든 파일이 d 디렉토리 밑에 있네요..

 

cd /users/pc/d

npm install or npm update 하시고

node server 해보세요

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

플로리아
9년 전
다시 사진으로 올렸습니다 ㅜㅜ 거의다 되는듯 싶은데.. 모듈 문제일까요?

댓글을 작성하려면 로그인이 필요합니다.

 

참고로 말씀드리면 http://uwooto.blogspot.kr/2014/09/nodejs-broswer-quest-windows.html">http://uwooto.blogspot.kr/2014/09/nodejs-broswer-quest-windows.html

여기나와 있는 설치법대로 하였으며 틀리게 한부분이 있다면

 log bison websocket websocket-server sanitizer memcache  이모듈들은 설치가 안되있습니다.

underscore 이것만 설치 했고 다른건 설치오류가 나와 설치하지 못했습니다.


 

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

9년 전
그냥 node server 로 하면 동작될 것 같은데요..
로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

플로리아
9년 전
ㅜㅜ 이렇게 대버리네요 ㅜㅜ 사진은 다시 답변으로 올렸어요

댓글을 작성하려면 로그인이 필요합니다.



C:\Users\PC\d 안에 다있어요 server 디렉토리 안에도 파일은 두개다 있구요

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

9년 전

모든 파일이 user/pc 디렉토리 아래에 있나요?

 

c:/user/pc>dir

[server]

...

 

식으로..

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

플로리아
9년 전
C:\Users\PC\d 이 디렉토리 아래에 전부 들어있습니다.
플로리아
9년 전
질문 답변 댓글로 사진 올려뒀습니다..

댓글을 작성하려면 로그인이 필요합니다.

9년 전

메시지가 

configuration file없이는 실행할수가 없다고 하니..

 

 

var defaultConfigPath = './server/config.json';

var customConfigPath = './server/config_local.json';

 

 

2가지 파일이 있는지 체크 해보세요..

 

path는 풀 path 보다는 그냥 모든 파일이 있는 곳에서 실행하는 것으로 해보세요..

 

node js/main.js 식으로..

 

현디렉토리안에 모든 구성이 있어야 겠죠..

 

물론 server 디렉토리안에 위의 json파일 2개가 있어야 겠죠..

 

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

플로리아
9년 전
var defaultConfigPath = './server/config.json';

var customConfigPath = './server/config_local.json';

위 두가지 파일은 server디렉토리안에 다 있습니다..
있는데도 안되네요 ㅜㅜ

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인