Node.js

Hey Devs,
I made a new experimental open source (MIT) plugin that embeds Node.js scripts as an actor component. Currently super early, but usable so wanted to share. Will likely have some bugs this early on, if you find any, post to Issues · getnamo/nodejs-ue4 · GitHub.

You can now write any node.js script and use npm modules to solve problems. The node instance is fully embedded, no external installation required.

Main repository and documentation:

Latest release:

Basic how-to

e.g. a simple math function using the npm package *ipc-event-emitter *to listen and reply with events


//myscript.js - Let's connect our function via IPC

//One liner include
const ipc = require('ipc-event-emitter').default(process);

const euclidean = (a, b) =>{
    return ((a ** 2) + (b ** 2)) ** 0.5;
}

//Listen to 'myevent' event
ipc.on('myevent', (vars) => {
    let c = euclidean(vars.x, vars.y);
    console.log('Got a request (a^2+b^2)^0.5: ' + c);

    //emit result back as a 'result' event
    ipc.emit('result', c);
});

console.log('started');

And on the blueprint side, add a node component

https://i.imgur.com/Xvc6v98.png

set your script

https://i.imgur.com/xalQplZ.png

and bind to the event you used in your script and you can call your script function to e.g. get the Pythagorean distance of two floats

https://i.imgur.com/XVe64kA.png

The scripts run on background threads and will not block the game thread. Messaging does callback on game thread so bound events are safe to use as usual.

That example is obviously just bare bones and not particularly useful, but you can change your script to use any NPM module (https://www.npmjs.com/) which has tons and tons of cool solutions to common programming problems.

See this list for some ideas: https://github.com/getnamo/nodejs-ue…you-do-with-it

Isn’t this just unreal.js?

Unreal.js is much much cooler and definitely better suited if you want to control unreal engine with javascript. This plugin instead focuses on bringing support for node.js API and full npm compatibility. You can probably use both together if you like.

Limitations

Win64 only for current builds.

4 Likes

NPM auto-resolving and live-reloading scripts is now supported.

Below is a novelty example testing the bandwidth of real-time communications, seems like you can easily do real-time and you’d need more than 20k messages/sec to impact the game thread without optimizations.

Hi, very good plugin.
but to solve the following error, when loading dependencies (ipc-event-emitter) I had to copy the entire Plugins/Content/Scripts directory to my [ProjectRoot]/Content/Scripts.
Is this correct? I thought I only had to indicate in Plugins/Content/Scripts/package.json the dependency to load.

Your initial thought is correct, the copying shouldn’t be necessary. Just did a test, but it appears it has memory for the last executable path and the old node instance doesn’t close always. After using the task manager to kill the stray node.js server and re-running the main script (either by restarting project or by running with bStopMainScriptOnNoListeners = true and exiting session) and then re-running again, the main script initializes correctly and will remain functioning as long as you don’t move the folder. At that point it will pull the correct dependency folder instead of a different old path.

Opened two new issues regarding these bugs here:
Hysteresis for old node path · Issue #8 · getnamo/NodeJs-Unreal · GitHub and Quitting with main script running doesn't always stop node instance · Issue #9 · getnamo/NodeJs-Unreal · GitHub

Hopefully this silly workaround can be fixed with something proper.

1 Like

Made some small changes which should fix the lack of node instance stop on exit (issue 9). Not sure if issue 8 has been fixed though. Made a simple test project release with the updated plugin here: Release Early Test v0.4.2 for UE 4.23 with Example Project · getnamo/NodeJs-Unreal · GitHub Check out the NodeJSExampleProject-v0.4.2.7z release which should be a drag and droppable project with two maps, one for simple.js and another for adder.js. Adder.js should test the auto-resolve dependencies. Let me know if that version works for you.

Only by playing AdderTestMap, the process imports the necessary modules and creates the node_modules folder.
But the following error appears, even killing the nodejs processes created.:


LogBlueprintUserMessages: Late PlayInEditor Detection: Level '/Game/AdderTestMap.AdderTestMap:PersistentLevel' has LevelScriptBlueprint '/Game/AdderTestMap.AdderTestMap:PersistentLevel.AdderTestMap' with GeneratedClass '/Game/AdderTestMap.AdderTestMap_C' with ClassGeneratedBy '/Game/AdderTestMap.AdderTestMap:PersistentLevel.AdderTestMap'
LogTemp: Error: Script Error: internal/modules/cjs/loader.js:638throw err;
    ^
Error: Cannot find module 'ipc-event-emitter'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (E:\Unreal Engine Projects2\NodeJSExamples\Content\Scripts\adder.js:4:13)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
LogTemp: package.json contains missing dependency ipc-event-emitter, auto-resolving.
LogBlueprintUserMessages: Early EndPlayMap Detection: Level '/Game/AdderTestMap.AdderTestMap:PersistentLevel' has LevelScriptBlueprint '/Game/AdderTestMap.AdderTestMap:PersistentLevel.AdderTestMap' with GeneratedClass '/Game/AdderTestMap.AdderTestMap_C' with ClassGeneratedBy '/Game/AdderTestMap.AdderTestMap:PersistentLevel.AdderTestMap'
LogSlate: Updating window title bar state: overlay mode, drag disabled, window buttons hidden, title bar hidden
LogWorld: BeginTearingDown for /Game/UEDPIE_0_AdderTestMap
LogTemp: Removed a listener, 0 listeners left
LogWorld: UWorld::CleanupWorld for AdderTestMap, bSessionEnded=true, bCleanupResources=true
LogPlayLevel: Display: Shutting down PIE online subsystems
LogBlueprintUserMessages: Late EndPlayMap Detection: Level '/Game/AdderTestMap.AdderTestMap:PersistentLevel' has LevelScriptBlueprint '/Game/AdderTestMap.AdderTestMap:PersistentLevel.AdderTestMap' with GeneratedClass '/Game/AdderTestMap.AdderTestMap_C' with ClassGeneratedBy '/Game/AdderTestMap.AdderTestMap:PersistentLevel.AdderTestMap'
LogSlate: Updating window title bar state: overlay mode, drag disabled, window buttons hidden, title bar hidden
LogTemp: Removed a listener, 0 listeners left
LogUObjectHash: Compacting FUObjectHashTables data took   1.38ms
LogPlayLevel: Display: Destroying online subsystem :Context_2
LogEditorSessionSummary: EditorSessionSummary sent report. Type=Shutdown, SessionId={35876D41-41C0-AB42-F3A1-D5B3D2CAC09A}
LogEditorSessionSummary: EditorSessionSummary sent report. Type=Shutdown, SessionId={9A010913-48C5-DF86-0F36-AB9C769B9159}
LogEditorSessionSummary: EditorSessionSummary sent report. Type=Shutdown, SessionId={907725D8-45DA-CDA0-9484-9B85CCFDCD72}
LogEditorSessionSummary: EditorSessionSummary sent report. Type=Shutdown, SessionId={6FAFF7A5-4F1A-DAEC-19D8-51A4D8621702}
LogDirectoryWatcher: A directory notification failed for 'E:/Unreal Engine Projects2/NodeJSExamples/Content/' because it was empty or there was a buffer overflow. Attemping another request...
LogDirectoryWatcher: A directory notification failed for 'E:/Unreal Engine Projects2/NodeJSExamples/Content/' because it was empty or there was a buffer overflow. Attemping another request...
LogDirectoryWatcher: A directory notification failed for 'E:/Unreal Engine Projects2/NodeJSExamples/Content/' because it was empty or there was a buffer overflow. Attemping another request...
LogDirectoryWatcher: A directory notification failed for 'E:/Unreal Engine Projects2/NodeJSExamples/Content/' because it was empty or there was a buffer overflow. Attemping another request...
LogDirectoryWatcher: A directory notification failed for 'E:/Unreal Engine Projects2/NodeJSExamples/Content/' because it was empty or there was a buffer overflow. Attemping another request...
LogDirectoryWatcher: A directory notification failed for 'E:/Unreal Engine Projects2/NodeJSExamples/Content/' because it was empty or there was a buffer overflow. Attemping another request...


process.PNG
Greetings.

The log looks correct for the first part, but then after the auto-resolve the script should run.

For the adder example it should look something like this the first time (press F to send input again):

https://youtube.com/watch?v=nDL92gPC_40](https://www.youtube.com/watch?v=nDL92gPC_40)

You can try to endplay/begin play a few times after pressing F to see if you get the adding blueprint to print out the default 5.0 value result. The javascript server does quit every time for me too. Regardless, something still appears broken :confused: TBC, might need to find other machines to test it on.

Hi, the last update for (nodejs-ue4-0.4.2) and (socketio-client-v1.2.0-UE4.23) works fine and now also works in StandAloneGame, NewEditorWindow (PIE) and VRPreview.
But when I pack the game, I don’t get these plugins to be packed too and therefore my tools don’t work. I have to specify in the *.uplugin that are installed:


"Installed": true,

However it also throws the following error when launching the packaged game:

Sin-título.png

Grettings

Great that the 0.4.2 update worked for you. Regarding packaging, I haven’t had time to address it yet, issue is being tracked here: Packaging Support · Issue #6 · getnamo/NodeJs-Unreal · GitHub. Largely I assume we just need to copy the thirdparty folder to the packaged build in the right location and it will work. TBC

1 Like

I got the following error when packaging the project for Windows.
I hope you find it useful, and if there is any correction soon.
I am using binary ue4. Not the code version.


UATHelper: Packaging (Windows (64-bit)): Running AutomationTool...
UATHelper: Packaging (Windows (64-bit)): Parsing command line: -ScriptsForProject=E:/WS/V32/V32.uproject BuildCookRun -nocompile -nocompileeditor -installed -nop4 -project=E:/WS/V32/V32.uproject -cook -stage -archive -archivedirectory=E:/WS/V32/Releases/1.0 -package -clientconfig=Shipping -ue4exe=C:\UE_4.23\Engine\Binaries\Win64\UE4Editor-Cmd.exe
 -clean -distribution -nodebuginfo -targetplatform=Win64 -build -utf8output
UATHelper: Packaging (Windows (64-bit)): Setting up ProjectParams for E:\WS\V32\V32.uproject
UATHelper: Packaging (Windows (64-bit)): V32.uproject requires a temporary target.cs to be generated (NodeJs plugin is enabled)
UATHelper: Packaging (Windows (64-bit)): ********** BUILD COMMAND STARTED **********
UATHelper: Packaging (Windows (64-bit)): Running: C:\UE_4.23\Engine\Binaries\DotNET\UnrealBuildTool.exe V32 Win64 Shipping -Project=E:\WS\V32\V32.uproject -Clean -NoHotReload E:\WS\V32\V32.uproject -NoUBTMakefiles  -remoteini="E:\WS\V32" -skipdeploy -distribution -nobuilduht -log="C:\Users\user1\AppData\Roaming\Unreal Engine\AutomationTool\Logs\
C+UE_4.23\UBT-V32-Win64-Shipping.txt"
UATHelper: Packaging (Windows (64-bit)):   Cleaning V32 binaries...
UATHelper: Packaging (Windows (64-bit)): Took 0,7496676s to run UnrealBuildTool.exe, ExitCode=0
UATHelper: Packaging (Windows (64-bit)): Running: C:\UE_4.23\Engine\Binaries\DotNET\UnrealBuildTool.exe V32 Win64 Shipping -Project=E:\WS\V32\V32.uproject  E:\WS\V32\V32.uproject -NoUBTMakefiles  -remoteini="E:\WS\V32" -skipdeploy -distribution -Manifest=E:\WS\V32\Intermediate\Build\Manifest.xml -NoHotReload -log="C:\Users\user1\AppData\Roam
ing\Unreal Engine\AutomationTool\Logs\C+UE_4.23\UBT-V32-Win64-Shipping_2.txt"
UATHelper: Packaging (Windows (64-bit)):   Parsing headers for V32
UATHelper: Packaging (Windows (64-bit)):     Running UnrealHeaderTool "E:\WS\V32\V32.uproject" "E:\WS\V32\Intermediate\Build\Win64\V32\Shipping\V32.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
UATHelper: Packaging (Windows (64-bit)):   Reflection code generated for V32 in 5,4502978 seconds
UATHelper: Packaging (Windows (64-bit)):   [Adaptive unity build] Excluded from CommandLine unity file: CommandLine.cpp
UATHelper: Packaging (Windows (64-bit)):   [Adaptive unity build] Excluded from SocketIOClient unity file: SIOMessageConvert.cpp
UATHelper: Packaging (Windows (64-bit)):   [Adaptive unity build] Excluded from SocketIOLib unity file: sio_client_impl.cpp, sio_packet.cpp, sio_socket.cpp, SocketIOLib.cpp
UATHelper: Packaging (Windows (64-bit)):   [Adaptive unity build] Excluded from CoreUtility unity file: FCoreUtility.cpp
UATHelper: Packaging (Windows (64-bit)):   Writing manifest to E:\WS\V32\Intermediate\Build\Manifest.xml
UATHelper: Packaging (Windows (64-bit)):   Using Visual Studio 2017 14.16.27023 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023) and Windows 10.0.17763.0 SDK (C:\Program Files (x86)\Windows Kits\10).
UATHelper: Packaging (Windows (64-bit)):   Building 24 actions with 16 processes...
UATHelper: Packaging (Windows (64-bit)):     [1/24] Default.rc2
UATHelper: Packaging (Windows (64-bit)):     [2/24] SharedPCH.Core.cpp
UATHelper: Packaging (Windows (64-bit)):     [3/24] V32.cpp
UATHelper: Packaging (Windows (64-bit)):     [4/24] CommandLine.cpp
UATHelper: Packaging (Windows (64-bit)):     [5/24] Module.CommandLine.cpp
UATHelper: Packaging (Windows (64-bit)):     [6/24] SharedPCH.Engine.cpp
UATHelper: Packaging (Windows (64-bit)):     [7/24] SharedPCH.Engine.RTTI.Exceptions.cpp
UATHelper: Packaging (Windows (64-bit)):     [8/24] SocketIOLib.cpp
UATHelper: Packaging (Windows (64-bit)):     [9/24] FCoreUtility.cpp
UATHelper: Packaging (Windows (64-bit)):     [10/24] Module.CoreUtility.gen.cpp
UATHelper: Packaging (Windows (64-bit)):     [11/24] Module.SIOJson.gen.cpp
UATHelper: Packaging (Windows (64-bit)):     [12/24] Module.CoreUtility.cpp
UATHelper: Packaging (Windows (64-bit)):     [13/24] sio_packet.cpp
UATHelper: Packaging (Windows (64-bit)):     [14/24] Module.NodeJs.gen.cpp
UATHelper: Packaging (Windows (64-bit)):     [15/24] Module.SocketIOClient.gen.cpp
UATHelper: Packaging (Windows (64-bit)):     [16/24] SIOMessageConvert.cpp
UATHelper: Packaging (Windows (64-bit)):     [17/24] Module.NodeJs.cpp
UATHelper: Packaging (Windows (64-bit)):     [18/24] Module.SIOJson.cpp
UATHelper: Packaging (Windows (64-bit)):     [19/24] Module.SocketIOClient.cpp
UATHelper: Packaging (Windows (64-bit)):     [20/24] sio_socket.cpp
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(390): error C2563: mismatch in formal parameter list
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(390): error C2568: '<<': unable to resolve function overload
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(390): note: could be 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(390): error C3861: 'LOG': identifier not found
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(397): error C2563: mismatch in formal parameter list
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(397): error C2568: '<<': unable to resolve function overload
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(397): note: could be 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(397): error C3861: 'LOG': identifier not found
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(404): error C2563: mismatch in formal parameter list
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(404): error C2568: '<<': unable to resolve function overload
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(404): note: could be 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(404): error C3861: 'LOG': identifier not found
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(427): error C2563: mismatch in formal parameter list
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(427): error C2568: '<<': unable to resolve function overload
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(427): note: could be 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(427): error C3861: 'LOG': identifier not found
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(443): error C2563: mismatch in formal parameter list
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(443): error C2568: '<<': unable to resolve function overload
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(443): note: could be 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(443): error C3861: 'LOG': identifier not found
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(499): error C2563: mismatch in formal parameter list
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(499): error C2568: '<<': unable to resolve function overload
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(499): note: could be 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
UATHelper: Packaging (Windows (64-bit)):     E:\WS\V32\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\sio_socket.cpp(499): error C3861: 'LOG': identifier not found
UATHelper: Packaging (Windows (64-bit)):     [21/24] Module.SocketIOLib.cpp
UATHelper: Packaging (Windows (64-bit)):     [22/24] sio_client_impl.cpp
UATHelper: Packaging (Windows (64-bit)): Took 39,3597632s to run UnrealBuildTool.exe, ExitCode=5
UATHelper: Packaging (Windows (64-bit)): UnrealBuildTool failed. See log for more details. (C:\Users\user1\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+UE_4.23\UBT-V32-Win64-Shipping_2.txt)
UATHelper: Packaging (Windows (64-bit)): AutomationTool exiting with ExitCode=5 (5)
UATHelper: Packaging (Windows (64-bit)): BUILD FAILED
PackagingResults: Error: Unknown Error


CommandUtils.Run: Took 39,3597632s to run UnrealBuildTool.exe, ExitCode=5
Program.Main: UnrealBuildTool failed. See log for more details. (C:\Users\user1\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+UE_4.23\UBT-V32-Win64-Shipping_2.txt)
Program.Main: AutomationException: UnrealBuildTool failed. See log for more details. (C:\Users\user1\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+UE_4.23\UBT-V32-Win64-Shipping_2.txt)
Program.Main:    en AutomationTool.CommandUtils.RunUBT(CommandEnvironment Env, String UBTExecutable, String CommandLine) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\UBTUtils.cs:línea 52
Program.Main:    en AutomationTool.CommandUtils.RunUBT(CommandEnvironment Env, String UBTExecutable, FileReference Project, String Target, UnrealTargetPlatform Platform, UnrealTargetConfiguration Config, String AdditionalArgs) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\UBTUtils.cs:línea 89
Program.Main:    en AutomationTool.UE4Build.BuildWithUBT(String TargetName, UnrealTargetPlatform TargetPlatform, UnrealTargetConfiguration Config, FileReference UprojectPath, Boolean ForceFlushMac, Boolean DisableXGE, String InAddArgs) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\UE4Build.cs:línea 227
Program.Main:    en AutomationTool.UE4Build.Build(BuildAgenda Agenda, Nullable`1 InDeleteBuildProducts, Boolean InUpdateVersionFiles, Boolean InForceNoXGE, Boolean InUseParallelExecutor, Boolean InShowProgress, Nullable`1 InChangelistNumberOverride, Dictionary`2 InTargetToManifest) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\UE4Build.cs:línea 1099
Program.Main:    en Project.Build(BuildCommand Command, ProjectParams Params, Int32 WorkingCL, ProjectBuildTargets TargetMask) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildProjectCommand.Automation.cs:línea 215
Program.Main:    en BuildCookRun.DoBuildCookRun(ProjectParams Params) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:línea 208
Program.Main:    en BuildCookRun.ExecuteBuild() en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:línea 41
Program.Main:    en AutomationTool.BuildCommand.Execute() en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:línea 263
Program.Main:    en AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:línea 551
Program.Main:    en AutomationTool.Automation.Process(String] Arguments, StartupTraceListener StartupListener) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:línea 521
Program.Main:    en AutomationTool.Program.MainProc(String] Arguments, StartupTraceListener StartupListener) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:línea 176
Program.Main:    en AutomationTool.Program.&lt;&gt;c__DisplayClass1_0.&lt;Main&gt;b__2() en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:línea 88
Program.Main:    en AutomationTool.InternalUtils.RunSingleInstance(Func`1 Main) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:línea 725
Program.Main:    en AutomationTool.Program.Main(String] Arguments) en D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:línea 88
Program.Main: AutomationTool exiting with ExitCode=5 (5)

If I deactivate that the plugins are installed then it cooks well. But then the plugins folder is not inside the cooked one.


"Installed": false,

Sin-título1.png
If I manually copy the plugins folder, then it gives the following error.
Sin-título0.png
Sin-título.png

Greetings.

2 Likes

Any progress to release plugin for version 4.24?
When migrating a project from 4.23 to 4.24, using the socketio plugin socketio-client-v1.3.2-UE4.24, I get the following error:



1>------ Build started: Project: NodeJSExamples, Configuration: Development_Editor x64 ------
1>Parsing headers for NodeJSExamplesEditor
1>  Running UnrealHeaderTool "E:\Unreal Engine Projects2\NodeJSExamples\NodeJSExamples.uproject" "E:\Unreal Engine Projects2\NodeJSExamples\Intermediate\Build\Win64\NodeJSExamplesEditor\Development\NodeJSExamplesEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
1>Reflection code generated for NodeJSExamplesEditor in 6,7840896 seconds
1>Building NodeJSExamplesEditor...
1>Using Visual Studio 2017 14.16.27034 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023) and Windows 10.0.17763.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>[Upgrade]
1>[Upgrade] Using backward-compatible build settings. The latest version of UE4 sets the following values by default, which may require code changes:
1>[Upgrade]     bLegacyPublicIncludePaths = false                 => Omits subfolders from public include paths to reduce compiler command line length. (Previously: true).
1>[Upgrade]     ShadowVariableWarningLevel = WarningLevel.Error   => Treats shadowed variable warnings as errors. (Previously: WarningLevel.Warning).
1>[Upgrade]     PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs   => Set in build.cs files to enables IWYU-style PCH model. See https://docs.unrealengine.com/en-US/Programming/BuildTools/UnrealBuildTool/IWYU/index.html. (Previously: PCHUsageMode.UseSharedPCHs).
1>[Upgrade] Suppress this message by setting 'DefaultBuildSettings = BuildSettingsVersion.V2;' in NodeJSExamplesEditor.Target.cs, and explicitly overriding settings that differ from the new defaults.
1>[Upgrade]
1>Building 6 actions with 16 processes...
1>  [1/6] Module.SocketIOLib.cpp
1>e:\unreal engine projects2
odejsexamples\plugins\socketio-client-ue4-1.3.2\source\socketiolib\private\internal\sio_client_impl.h(34): fatal error C1083: Cannot open include file: 'websocketpp/client.hpp': No such file or directory
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command "C:\UE_4.24\Engine\Build\BatchFiles\Build.bat NodeJSExamplesEditor Win64 Development -Project="E:\Unreal Engine Projects2\NodeJSExamples\NodeJSExamples.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command.
1>Done building project "NodeJSExamples.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


missingNodeJS-Modules_0.PNG
missingNodeJS-Modules_1.PNG

v0.5.0 released with packaging and UE4.24 support. You can find it here: Release v0.5.0 for UE 4.23-4.24 · getnamo/NodeJs-Unreal · GitHub, let me know if you run into any new issues

It is good to know that it can already be used in the UE4.24.
But I tried the sample project, and when packaged, the Node component does not work, and the necessary third-party folders are not packaged:

0.PNG
1.PNG
-the Scripts folder if added correctly:

2.PNG


Attached log with errors:



[2020.02.24-18.29.22:720]  0]LogInit: Display: Game Engine Initialized.
[2020.02.24-18.29.22:721]  0]LogInit: Display: Starting Game.
[2020.02.24-18.29.22:721]  0]LogNet: Browse: /Game/SimpleTestMap?Name=Player
[2020.02.24-18.29.22:721]  0]LogLoad: LoadMap: /Game/SimpleTestMap?Name=Player
[2020.02.24-18.29.22:721]  0]LogWorld: BeginTearingDown for /Temp/Untitled_0
[2020.02.24-18.29.22:722]  0]LogWorld: UWorld::CleanupWorld for Untitled, bSessionEnded=true, bCleanupResources=true
[2020.02.24-18.29.22:723]  0]LogSlate: InvalidateAllWidgets triggered.  All widgets were invalidated
[2020.02.24-18.29.22:727]  0]LogAudioMixer: Display: No commands were queued while flushing the source manager.
[2020.02.24-18.29.22:730]  0]LogUObjectHash: Compacting FUObjectHashTables data took   2.26ms
[2020.02.24-18.29.22:740]  0]LogStreaming: Error: Couldn't find file for package /Script/NodeJs requested by async loading code. NameToLoad: /Script/NodeJs
[2020.02.24-18.29.22:740]  0]LogStreaming: Error: Found 1 dependent packages...
[2020.02.24-18.29.22:740]  0]LogStreaming: Error:   /Game/SimpleTestMap
[2020.02.24-18.29.22:741]  0]LogStreaming: Error: ****DumpDependencies [Dependencies]:
[2020.02.24-18.29.22:741]  0]LogStreaming: Error:     Export 11 /Game/SimpleTest.SimpleTest_C:Node_GEN_VARIABLE
[2020.02.24-18.29.22:741]  0]LogStreaming: Error:     Linker is ../../../NodeJSExamples/Content/SimpleTest.uasset
[2020.02.24-18.29.22:741]  0]LogStreaming: Error:         Dep S_BEFORE_S Export     1    /Game/SimpleTest.SimpleTest_C     (class BlueprintGeneratedClass)
[2020.02.24-18.29.22:742]  0]LogStreaming: Error:         Dep S_BEFORE_C Import    15   /Script/NodeJs.NodeComponent
[2020.02.24-18.29.22:742]  0]LogStreaming: Error:         Dep S_BEFORE_C Import    20   /Script/NodeJs.Default__NodeComponent
[2020.02.24-18.29.22:742]  0]LogStreaming: Error:         Dep C_BEFORE_C Export     1    /Game/SimpleTest.SimpleTest_C     (class BlueprintGeneratedClass)
[2020.02.24-18.29.22:742]  0]LogStreaming: Error: Missing Dependency, request for /Script/NodeJs.NodeComponent but it hasn't been created yet.
[2020.02.24-18.29.22:742]  0]LogStreaming: Error: Could not find class NodeComponent to create Node_GEN_VARIABLE
[2020.02.24-18.29.22:744]  0]LogStreaming: Error: ****DumpDependencies [Dependencies]:
[2020.02.24-18.29.22:744]  0]LogStreaming: Error:     Export 16 /Game/SimpleTestMap.SimpleTestMap:PersistentLevel.TestNodejs_2.Node
[2020.02.24-18.29.22:744]  0]LogStreaming: Error:     Linker is ../../../NodeJSExamples/Content/SimpleTestMap.umap
[2020.02.24-18.29.22:744]  0]LogStreaming: Error:         Dep C_BEFORE_S Import     3   /Game/SimpleTest.SimpleTest_C
[2020.02.24-18.29.22:744]  0]LogStreaming: Error:         Dep S_BEFORE_C Import    33   /Script/NodeJs.NodeComponent
[2020.02.24-18.29.22:744]  0]LogStreaming: Error:         Dep S_BEFORE_C Import    46   /Game/SimpleTest.SimpleTest_C:Node_GEN_VARIABLE
[2020.02.24-18.29.22:744]  0]LogStreaming: Error:         Dep C_BEFORE_C Export    20    /Game/SimpleTestMap.SimpleTestMap:PersistentLevel.TestNodejs_2     (class SimpleTest_C)
[2020.02.24-18.29.22:744]  0]LogStreaming: Error: Missing Dependency, request for /Script/NodeJs.NodeComponent but it hasn't been created yet.
[2020.02.24-18.29.22:744]  0]LogStreaming: Error: Could not find class NodeComponent to create Node
[2020.02.24-18.29.22:749]  0]LogAIModule: Creating AISystem for world SimpleTestMap
[2020.02.24-18.29.22:749]  0]LogLoad: Game class is 'GameModeBase'
[2020.02.24-18.29.22:750]  0]LogWorld: Bringing World /Game/SimpleTestMap.SimpleTestMap up for play (max tick rate 0) at 2020.02.24-19.29.22
[2020.02.24-18.29.22:750]  0]LogWorld: Bringing up level for play took: 0.001094
[2020.02.24-18.29.22:752]  0]LogLoad: Took 0.031467 seconds to LoadMap(/Game/SimpleTestMap)
[2020.02.24-18.29.22:771]  0]LogRenderer: Reallocating scene render targets to support 1920x1080 Format 10 NumSamples 1 (Frame:1).
[2020.02.24-18.29.22:771]  0]LogLoad: (Engine Initialization) Total time: 1.49 seconds
[2020.02.24-18.29.22:801]  0]LogContentStreaming: Texture pool size now 1000 MB
[2020.02.24-18.29.22:832]  2]LogRenderer: Reallocating scene render targets to support 128x128 Format 10 NumSamples 1 (Frame:1).
[2020.02.24-18.29.22:855]  2]LogRenderer: Reallocating scene render targets to support 1920x1080 Format 10 NumSamples 1 (Frame:2).
[2020.02.24-18.29.25:556][567]LogSlate: Took 0.000265 seconds to synchronously load lazily loaded font '../../../Engine/Content/Slate/Fonts/Roboto-Regular.ttf' (155K)
[2020.02.24-18.29.27:026][865]LogWindowsDesktop: Alt-F4 pressed!
[2020.02.24-18.29.27:027][865]LogSlate: Request Window 'NodeJSExamples (64-bit Development PCD3D_SM5) ' being destroyed


I forget something?
Greetings.

1 Like

Hey, Great plug-in. just installed it and got running my scripts straight away so thank you for releasing it!

Now, this is probably a silly question but is there any way you could run a ‘script.js’ from the editor. ie from an editor utility widget etc and not rely on runtime?

Thanks

Interesting use case request. While I didn’t personally think of using the plugin this way, it could be enabled by writing a new wrapper with editor context. I made a github issue for this here: Run in Editor context · Issue #25 · getnamo/nodejs-ue4 · GitHub. If you come up with specific UX patterns you would want, it would better guide how to add this feature. Keep in mind this issue may take a while to schedule for me (code contributions welcome!).

Due to a request I made a UE5EA build which can be found here: Release v0.8.0 for UE 5.0 · getnamo/nodejs-ue4 · GitHub. May have bugs!

Hello, I’m not a programmer so having a bit of trouble getting this plugin to work.
This is for [v0.7.0 for UE 4.26]

Got the same error as a user above, when loading dependencies (ipc-event-emitter).
Copied the nodejs-ue4/content/scripts into my projects scripts.
Now I’m getting the effect that, the first time I PIE, there’s the following message:

SocketIO: SocketIO Invalid appears to have lost connection, reconnecting attempt 1 with delay 5000
LogTemp: Error: Main script connection error! Likely crash, stopping main script.

I can trigger the editor to crash, and then the last message is

SocketIO: SocketIo Connected with session: [random letters]
SocketIO: SocketIO [random letters] connected to namespace: /
LogTemp: Main script Connected.

Then, what is interesting is that when I PIE again this time, it’ll work.
As already stated, old node instances doesn’t close, and I suppose that is why it works this time.
But. As stated, I’m not a programmer and have no idea what to do to fix this.

This is a fantastic plugin with great promise. I have it running in the example project and added my own node.js scripts to it and it works great. However in another project I have added it to Unreal 4.26.2 using the version of socket.io targeting this version. I get the following output.log error… Any ideas what to try?

LogHttp: Warning: 000002C4A1F67200: invalid HTTP response code received. URL: http://localhost:8003/, HTTP code: 0, content length: 0, actual payload size: 0
LogHttp: Warning: 000002C4A1F67200: request failed, libcurl error: 7 (Couldn't connect to server)
LogHttp: Warning: 000002C4A1F67200: libcurl info message cache 0 (Hostname in DNS cache was stale, zapped)
LogHttp: Warning: 000002C4A1F67200: libcurl info message cache 1 (  Trying ::1...)
LogHttp: Warning: 000002C4A1F67200: libcurl info message cache 2 (TCP_NODELAY set)
LogHttp: Warning: 000002C4A1F67200: libcurl info message cache 3 (  Trying 127.0.0.1...)
LogHttp: Warning: 000002C4A1F67200: libcurl info message cache 4 (TCP_NODELAY set)
LogHttp: Warning: 000002C4A1F67200: libcurl info message cache 5 (connect to ::1 port 8003 failed: Connection refused)
LogHttp: Warning: 000002C4A1F67200: libcurl info message cache 6 (connect to 127.0.0.1 port 8003 failed: Connection refused)
LogHttp: Warning: 000002C4A1F67200: libcurl info message cache 7 (Failed to connect to localhost port 8003: Connection refused)
LogHttp: Warning: 000002C4A1F67200: libcurl info message cache 8 (Closing connection 7)

I believe an older version of the plugin was dependent on socket.io v1-2 libraries and that mightve been the conflict. Newer releases of socket.io sub-plugin should support the v3+ libraries.

I also had a similar issue while trying tp use ipc-event-emitter. I was also able to solve it by copy/pasting the folders like Heighast did. Now, however, I have to restart the editor after hitting play, because the javascript won’t run a second time after I make any changes to the javascript code. I have to restart before I can play again with the script running. Like stefnar, I am also not a programmer and I am not quite certain how to fix this problem. I don’t know if maybe it’s a question of the old node instances not closing? Any help would be appreciated.

I see that this problem happens when I hit play again and I get the following error:
LogUObjectGlobals: Warning: Failed to find object ‘Class None.SIOJJsonObject’

Socket IO seems to be acting up somehow?