laverdet / xxscreeps

Other
71 stars 16 forks source link

Add vscode .devcontainer settings for dockerized development environment #48

Open HenryJk opened 2 years ago

HenryJk commented 2 years ago

This PR is adding basic settings for dockerizing dev environment in vscode. Developing inside a docker container allows for easy setup and isolates the dev environment from your machine, preventing the project from polluting the global installation. Also, for easy access to different node version without using nvm.

thmsndk commented 2 years ago

@HenryJk I am on windows, and I am getting the following error when I try to start the server, I am trying to work around the crash others experience in #36 by running it as a container. have you experienced this error using this container?

keep in mind this is the first time I am using a dockerized dev container as dev environment, so I might be missing some steps for it to work.

root@docker-desktop:/workspaces/xxscreeps# npx xxscreeps start
🌎 Listening

node:internal/process/esm_loader:94
    internalBinding('errors').triggerUncaughtException(
                              ^
Error: /workspaces/xxscreeps/node_modules/isolated-vm/out/isolated_vm.node: invalid ELF header
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/workspaces/xxscreeps/node_modules/isolated-vm/isolated-vm.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}
thmsndk commented 2 years ago

Okay it works now, the issue was my node_modules was from windows, deleting that and installing it with npm install from inside the docker container / visual studio code fixed the issues and I was able to start the server