ncsoft / Unreal.js

Unreal.js: Javascript runtime built for UnrealEngine
Other
3.67k stars 351 forks source link

Weird module errors #285

Open ughstudios opened 4 years ago

ughstudios commented 4 years ago

Anyone know how to get this to work?

Here is my code:

/// <reference path="typings/ue.d.ts">/>
// ; typing info for auto-completion in Visual Studio Code

"use strict"
var mumble = require('mumble'),
    fs = require('fs');

var onInit = function() {
    console.log( 'Connection initialized' );

    // Connection is authenticated and usable.
};

var onVoice = function( voice ) {
    console.log( 'Mixed voice' );

    var pcmData = voice;
};

function main() {

   var options = {
        key: fs.readFileSync( 'key.pem' ),
        cert: fs.readFileSync( 'cert.pem' )
    };

   console.log( 'Connecting' );
    mumble.connect( 'mumble://example.org', options, function ( error, connection ) {
        if( error ) { throw new Error( error ); }

        console.log( 'Connected' );

        connection.authenticate( 'ExampleUser' );
        connection.on( 'initialized', onInit );
        connection.on( 'voice', onVoice );
    });

    // clean up the mess
    return function () {

    }
}

// bootstrap to initiate live-reloading dev env.
try {

    module.exports = () => {

        let cleanup = null

        // wait for map to be loaded.
        process.nextTick(() => cleanup = main());

        // live-reloadable function should return its cleanup function
        return () => cleanup()
    }

}
catch (e) {
    require('bootstrap')('VoiceChat')
}

Here is my errors:

Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/util.js:149: ReferenceError: process is not defined
Javascript: Error: ReferenceError: process is not defined
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/util.js:149:1
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/util.js:396:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/util.js:397:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:3:18
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:41:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:42:25
Javascript: Error:     at file:///../../../../Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:5:14
Javascript: Error:     at file:///../../../../Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:63:3
Javascript: Invalid script for require
Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/bindings/bindings.js:12: ReferenceError: process is not defined
Javascript: Error: ReferenceError: process is not defined
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/bindings/bindings.js:12:16
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/bindings/bindings.js:168:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/bindings/bindings.js:169:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:2:20
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:22:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:23:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:4:14
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1010:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1011:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:5:24
Javascript: Invalid script for require
Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:2: TypeError: require(...) is not a function
Javascript: Error: TypeError: require(...) is not a function
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:2:39
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:22:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:23:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:4:14
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1010:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1011:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:5:24
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:41:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:42:25
Javascript: Error:     at file:///../../../../Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:5:14
Javascript: Invalid script for require
Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/celt/index.js:2: TypeError: require(...) is not a function
Javascript: Error: TypeError: require(...) is not a function
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/celt/index.js:2:34
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/celt/index.js:7:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/celt/index.js:8:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:5:19
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1010:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1011:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:5:24
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:41:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:42:25
Javascript: Error:     at file:///../../../../Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:5:14
Javascript: Invalid script for require
Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:5: TypeError: Cannot read property 'CeltEncoder' of undefined
Javascript: Error: TypeError: Cannot read property 'CeltEncoder' of undefined
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:5:36
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1010:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1011:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:5:24
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:41:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:42:25
Javascript: Error:     at file:///../../../../Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:5:14
Javascript: Error:     at file:///../../../../Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:63:3
Javascript: Invalid script for require
Javascript: Warning: Undefined required script 'tls'
Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:11: TypeError: Cannot read property 'celtVersions' of undefined
Javascript: Error: TypeError: Cannot read property 'celtVersions' of undefined
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:11:35
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:41:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:42:25
Javascript: Error:     at file:///../../../../Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:5:14
Javascript: Error:     at file:///../../../../Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:63:3
Javascript: Invalid script for require
Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/bindings/bindings.js:16: TypeError: Cannot read property 'node' of undefined
Javascript: Error: TypeError: Cannot read property 'node' of undefined
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/bindings/bindings.js:16:35
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/bindings/bindings.js:168:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/bindings/bindings.js:169:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:2:20
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:22:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:23:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:4:14
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1010:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1011:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:5:24
Javascript: Invalid script for require
Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:2: TypeError: require(...) is not a function
Javascript: Error: TypeError: require(...) is not a function
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:2:39
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:22:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/jitterbuffer/index.js:23:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:4:14
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1010:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1011:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:5:24
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:41:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:42:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:5:14
Javascript: Invalid script for require
Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/celt/index.js:2: TypeError: require(...) is not a function
Javascript: Error: TypeError: require(...) is not a function
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/celt/index.js:2:34
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/celt/index.js:7:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/celt/index.js:8:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:5:19
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1010:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1011:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:5:24
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:41:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:42:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:5:14
Javascript: Invalid script for require
Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:5: TypeError: Cannot read property 'CeltEncoder' of undefined
Javascript: Error: TypeError: Cannot read property 'CeltEncoder' of undefined
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:5:36
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1010:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnection.js:1011:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:5:24
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:41:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:42:25
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:5:14
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:63:4
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:64:25
Javascript: Error:     at default_exec (file:///c:/Users/decil/Desktop/HVS_Game/Plugins/UnrealJS/Content/Scripts/devrequire.js:19:16)
Javascript: Invalid script for require
Javascript: Warning: Undefined required script 'tls'
Javascript: Connecting
Javascript: Error: file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnectionManager.js:52: TypeError: Cannot read property 'connect' of undefined
Javascript: Error: TypeError: Cannot read property 'connect' of undefined
Javascript: Error:     at MumbleConnectionManager.connect (file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/lib/MumbleConnectionManager.js:52:23)
Javascript: Error:     at Object.exports.connect (file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/node_modules/mumble/index.js:37:13)
Javascript: Error:     at main (file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:29:12)
Javascript: Error:     at file:///c:/Users/decil/Desktop/HVS_Game/Content/Scripts/VoiceChat.js:53:42
Javascript: Error:     at invoke_next (file:///../../../../Users/decil/Desktop/HVS_Game/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:14:9)
Javascript: Error:     at Array.forEach (<anonymous>)
Javascript: Error:     at Object.flushTicks (file:///../../../../Users/decil/Desktop/HVS_Game/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:36:18)
Javascript: Error:     at root (file:///../../../../Users/decil/Desktop/HVS_Game/Plugins/UnrealJS/Content/Scripts/polyfill/timers.js:20:24)
crocuis commented 4 years ago

Since unreal.js is not dependent on node.js, you cannot use modules like 'fs'.