Mods not playing nice with isolated VM on private server?



  • I was trying to follow the instructions here: http://docs.screeps.com/contributed/ps_ubuntu.html

    and everything works nicely if I skip installing any of the custom mods. However if I do install a mod, for example:

    screeps@sosscreeps2:~/world$ npm install screepsmod-auth
    + screepsmod-auth@2.4.5
    added 11 packages and removed 419 packages in 11.325s
    

    Then all the isolated VM stuff is gone, I assume as part of the 419 packages npm just removed?

    screeps@sosscreeps2:~/world$ find ~ -name "*isolate*"
    screeps@sosscreeps2:~/world$
    

    If I go on to run the server in this state it quickly generates errors for the missing files:

    screeps@sosscreeps2:~/world$ npx screeps start
    In file included from ../src/pf.cc:2:0:
    ../src/pf.h: In member function ‘screeps::world_position_t 
    screeps::world_position_t::position_in_direction(
    screeps::world_position_t::direction_t) const’:
    ../src/pf.h:117:4: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
    module.js:549
        throw err;
        ^
    
    Error: Cannot find module './build/Release/isolated_vm'
        at Function.Module._resolveFilename (module.js:547:15)
        at Function.Module._load (module.js:474:25)
        at Module.require (module.js:596:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous> 
    
    /home/screeps/.npm/_npx/16677/lib/node_modules/screeps/node_modules/
    isolated-vm/isolated-vm.js:1:80)
        at Module._compile (module.js:652:30)
        at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    
    
    /home/screeps/.npm/_npx/16677/lib/node_modules/screeps/node_modules/
    webpack-shell-plugin/lib/index.js:168
    

    Similar behavior happened with other mods I tried. I haven't investigated much and I'm a relative newcomer to the npm package management world so there may be easy solutions I am unaware of. Just figured I should ask before spending too much time on it.

    Thanks! -Duegin


  • Dev Team

    @duegin This looks very strange. Installing a npm module should not remove another module ever. I've tried but couldn't reproduce this, the instructions from the guide work fine for me.

    Could you please run npm list in your ~/world directory and copy-paste the entire output here?



  • @artch thanks for getting back to me! Sadly my attempt to use 'npm list' consumed all the memory on the machine (its a VM with 4GB) so my SSH session got disconnected and I had to reboot it without getting a result. However as long as you say it doesn't repro for you I'm happy to assume its an issue local to my machine setup and I'll try to figure out what I did to cause it. If I discover anything interesting that isn't between keyboard and chair I'll let you know.

    Appreciate it, -Duegin



  • For anyone else that might run into this in the future I set up a second VM that I think was identical to the first, except this time I started by running

     npm i npm@latest -g
    

    and the problem no longer reproduces. I can't guarantee it was this and not something else, but it seems like a good bet.



  • Further experimentation muddied the waters again. Updating npm to latest seemed to fix the issue when I installed one particular mod (I can't recall which it was) but then when I came back later to install others the problem was back. I wound up working around it a different way by running

    npm install screeps
    

    a second time after installing the mods. This restored the files that were removed during the mod installation. I also noticed some long github threads which might be related but I did not confirm:

    https://github.com/npm/npm/issues/17379


  • Dev Team

    Could you describe exact steps to reproduce this issue on a clean machine?