Search Unity

Why node_modules is inside Unity Hub?

Discussion in 'Unity Hub' started by WillNode, Feb 16, 2018.

  1. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    I peek the Unity Hub Program files and there's a whopping node_modules worth 132 MB:

    Screenshot (104).png

    What I found is that I can delete this folder and the Hub still run perfectly fine.

    Can we remove this folder from installer/binaries? Think bandwidths and storages saved from doing this.
     
    Last edited: Feb 16, 2018
  2. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Oh yeah, I also have electron and nodeJS installed globally on my computer but I doubt it effects anyway. Can anybody confirm that this works on computer without nodeJS?
     
  3. TaleOf4Gamers

    TaleOf4Gamers

    Joined:
    Nov 15, 2013
    Posts:
    825
    I just tried it and I'm not too sure if its connected but I had to get a new license for the hub and upon trying to launch 2017.3 it immediately crashed and open the report a bug window.

    The hub though, seemed to work fine. I will check again soon.
     
  4. Le_Tai

    Le_Tai

    Joined:
    Jun 20, 2014
    Posts:
    442
    node_modules folder is created in every folder that make use of npm. Apparent Unity use npm for their package manager instead of creating their own solution - which is probably a good thing.

    A little advice from my experience: If you ever see that folder in your IDE/text editor, DON'T touch it.
     
    TaleOf4Gamers likes this.
  5. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    From my observation the content of that node_modules is only: electron.

    But that's weird. When you build an electron apps, all binary files necessary to make it run is already in root folder (proof: binary files in node_modules/electron/dist is exact same with root), which means these files are just duplicates and not get used.

    Similar apps built from electron like VS Code for example, doesn't bundle electron in it. This one is weird, I suspect this node_modules are traces from development build.

    Also note that the real node_modules that used by electron have to be in folder 'resources', so yeah :rolleyes:
     
  6. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    More visual explanation (because I like to do it):

    unityhubtreewastes.png
    Here's the comparison with VS Code:

    vscodetree.png

    Can you see that electron bundle in VS Code?
     
  7. afshinity

    afshinity

    Unity Technologies

    Joined:
    Jul 31, 2017
    Posts:
    334
    Hi there,

    This folder and the electron inside it is removed in 0.13.0. Stay tuned for the update
     
    WillNode and TaleOf4Gamers like this.
  8. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Yay! Thanks so much :)