OpenFactorioServerManager / factorio-server-manager

A tool to help manage Factorio multiplayer servers including mods and save games.
MIT License
544 stars 132 forks source link

Stop Server Command does not work in Windows #37

Closed xeroiv closed 7 years ago

xeroiv commented 7 years ago

When pressing the Stop button on the UI I am greeted with an error popup "stop server handler: not supported in Windows". The log file on the UI does not show the lines associated with the error. In the terminal window it logged some output.

Error in server handler: not supported by windows
Creating server status response
Server status sent with data: map[status:running port:34197 savefile:multiplyer.zip]
xlemmingx commented 7 years ago

This is caused by the way the function is trying to kill the process. It currently uses the signal library and sends a SIGINT to the process. Windows does not implement signals this way so this works only on unix-based systems.

A fix i could think of is using f.Cmd.Process.Kill() instead of f.Cmd.Process.Signal(syscall.SIGINT) (untested) or by calling the executable again with --stop param (propably unwanted).

mroote commented 7 years ago

That's right, I was using the Linux system calls for this function to kill the process as it stops the server cleaning if you send a SIGINT.

I'm not sure what signal the Process.Kill() method gives but I think I was having an issue with this method killing the process uncleanly so any open maps wouldn't be saved. I'll have to test again and see what the result is as that would help with supporting Windows.

mroote commented 7 years ago

I was checking the Factorio changelog and it appears in 0.12.31 they fixed a bug where stopping the server with SIGTERM (ctrl-c on headless server) would not save. https://forums.factorio.com/viewtopic.php?t=23342

I think we can change the stop function to use Process.Kill() and it should work properly in Windows more testing required.

bostelk commented 7 years ago

SIGKILL will terminate the process without saving the map. For now on Windows I've added a patch to kill the process.

ghost commented 7 years ago

Not to take this off topic, but how does one install this on windows? Unfortunately I run a windows 2012 server for other application reason so would love to see how to get this going for me.

mroote commented 7 years ago

Same way as the Linux version pretty much, you will have to cross compile the Windows binary if you are running Linux or build the binary from a Windows machine.

After the binary is compiled it runs the same as the Linux version, launch the server manager via Powershell or cmd with the same flags.

xeroiv commented 7 years ago

You can use GO to compile it as an exe, as well.

On Oct 4, 2016 1:04 PM, "Mitch Roote" notifications@github.com wrote:

Same way as the Linux version pretty much, you will have to cross compile the Windows binary if you are running Linux or build the binary from a Windows machine.

After the binary is compiled it runs the same as the Linux version, launch the server manager via Powershell or cmd with the same flags.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MajorMJR/factorio-server-manager/issues/37#issuecomment-251449334, or mute the thread https://github.com/notifications/unsubscribe-auth/AGUcB0ukfhGwLkLr6VXCFjRs1OHRjcZ_ks5qwocbgaJpZM4JRHkV .

ghost commented 7 years ago

Installed GO and tried this. Not used to compiling anything and hate having to have my hand held. Also installed Node.js for windows as well.

C:\factorio-server-manager-0.4.3\src>go build
auth.go:7:2: cannot find package "github.com/apexskier/httpauth" in any of:
        C:\Go\src\github.com\apexskier\httpauth (from $GOROOT)
        ($GOPATH not set)
gameconfig.go:6:2: cannot find package "github.com/go-ini/ini" in any of:
        C:\Go\src\github.com\go-ini\ini (from $GOROOT)
        ($GOPATH not set)
handlers.go:15:2: cannot find package "github.com/gorilla/mux" in any of:
        C:\Go\src\github.com\gorilla\mux (from $GOROOT)
        ($GOPATH not set)
gamelog.go:6:2: cannot find package "github.com/hpcloud/tail" in any of:
        C:\Go\src\github.com\hpcloud\tail (from $GOROOT)
        ($GOPATH not set)

Then when I go to the github.com URL's meantion I download them and put them in C:\GO\src\github.com\foldernamestructurementioned

C:\factorio-server-manager-0.4.3\src>go build
C:\Go\src\github.com\gorilla\mux\context_gorilla.go:8:2: cannot find package "github.com/gorilla/context" in any of:
        C:\Go\src\vendor\github.com\gorilla\context (vendor tree)
        C:\Go\src\github.com\gorilla\context (from $GOROOT)
        ($GOPATH not set)
C:\Go\src\github.com\apexskier\httpauth\auth.go:25:2: cannot find package "github.com/gorilla/sessions" in any of:
        C:\Go\src\vendor\github.com\gorilla\sessions (vendor tree)
        C:\Go\src\github.com\gorilla\sessions (from $GOROOT)
        ($GOPATH not set)
C:\Go\src\github.com\apexskier\httpauth\leveldbAuthBackend.go:7:2: cannot find package "github.com/syndtr/goleveldb/leveldb" in any of:
        C:\Go\src\vendor\github.com\syndtr\goleveldb\leveldb (vendor tree)
        C:\Go\src\github.com\syndtr\goleveldb\leveldb (from $GOROOT)
        ($GOPATH not set)
C:\Go\src\github.com\apexskier\httpauth\auth.go:26:2: cannot find package "golang.org/x/crypto/bcrypt" in any of:
        C:\Go\src\vendor\golang.org\x\crypto\bcrypt (vendor tree)
        C:\Go\src\golang.org\x\crypto\bcrypt (from $GOROOT)
        ($GOPATH not set)
C:\Go\src\github.com\apexskier\httpauth\mongoBackend.go:5:2: cannot find package "gopkg.in/mgo.v2" in any of:
        C:\Go\src\vendor\gopkg.in\mgo.v2 (vendor tree)
        C:\Go\src\gopkg.in\mgo.v2 (from $GOROOT)
        ($GOPATH not set)
C:\Go\src\github.com\apexskier\httpauth\mongoBackend.go:6:2: cannot find package "gopkg.in/mgo.v2/bson" in any of:
        C:\Go\src\vendor\gopkg.in\mgo.v2\bson (vendor tree)
        C:\Go\src\gopkg.in\mgo.v2\bson (from $GOROOT)
        ($GOPATH not set)
mroote commented 7 years ago

You will want to use the 'go get' command to download the third party libraries. Check the travis.yml file for a list of them.

Just run go get github.com/apexskier/httpauth

ghost commented 7 years ago

Getting: package github.com/apexskier/httpauth: cannot download, $GOPATH not set. For more details see: go help gopath EDIT: Ok set GOPATH in windows environment variables to C:\GO warning: GOPATH set to GOROOT (C:\Go\) has no effect go: missing Git command. See https://golang.org/s/gogetcmd package github.com/apexskier/httpauth: exec: "git": executable file not found in %PATH% Now get this, I think maybe I messed up git installation.

DOUBLE EDIT: Reinstalled git for windows and it worked yay, now to figure out how to built exe

ghost commented 7 years ago

Ok, got this far. Ran src.exe from cmd.

C:\Users\kevin\Downloads\factorio-server-manager-0.4.3\src>src.exe
2016/10/04 17:40:11 Error loading config file.: open ./conf.json: The system cannot find the file specified.
panic: Error loading config file.: open ./conf.json: The system cannot find the file specified.

goroutine 1 [running]:
panic(0x860f40, 0xc08200b890)
        C:/Go/src/runtime/panic.go:464 +0x3f4
main.failOnError(0x11347e0, 0xc08205b560, 0xa5b880, 0x1a)
        C:/Users/kevin/Downloads/factorio-server-manager-0.4.3/src/main.go:38 +0x2ff
main.loadServerConfig(0x9f4b60, 0xb)
        C:/Users/kevin/Downloads/factorio-server-manager-0.4.3/src/main.go:47 +0x80
main.main()
        C:/Users/kevin/Downloads/factorio-server-manager-0.4.3/src/main.go:78 +0x55

Then copied example json without .example and got this C:\Users\kevin\Downloads\factorio-server-manager-0.4.3\src>src.exe 2016/10/04 17:41:03 Created initial user: admin Starting server on: 0.0.0.0:8080

Couldn't access web page as it stated 404 page not found. I just want your sweet sweet nectar of a server manager <3

bostelk commented 7 years ago

Follow the instructions. You need to "compile" the react frontend. I think...

ghost commented 7 years ago

Yeah, I tried that installing nvm for windows and it takes control of nodejs 4.2.6 then doing this cd ui/ npm install Results:

npm WARN package.json factorio-mod-manager@0.1.0 No repository field.
npm WARN package.json factorio-mod-manager@0.1.0 No README data
npm WARN optional dep failed, continuing fsevents@1.0.14
react-dom@15.3.2 node_modules\react-dom

style-loader@0.13.1 node_modules\style-loader
└── loader-utils@0.2.16 (object-assign@4.1.0, big.js@3.1.3, emojis-list@2.1.0, json5@0.5.0)

sweetalert@1.1.3 node_modules\sweetalert

babel-loader@6.2.5 node_modules\babel-loader
├── object-assign@4.1.0
├── loader-utils@0.2.16 (big.js@3.1.3, emojis-list@2.1.0, json5@0.5.0)
└── mkdirp@0.5.1 (minimist@0.0.8)

react-router@2.8.1 node_modules\react-router
├── invariant@2.2.1
├── warning@3.0.0
├── hoist-non-react-statics@1.2.0
├── loose-envify@1.2.0 (js-tokens@1.0.3)
└── history@2.1.2 (warning@2.1.0, deep-equal@1.0.1, query-string@3.0.3)

webpack@1.13.2 node_modules\webpack
├── interpret@0.6.6
├── tapable@0.1.10
├── clone@1.0.2
├── async@1.5.2
├── supports-color@3.1.2 (has-flag@1.0.0)
├── loader-utils@0.2.16 (object-assign@4.1.0, big.js@3.1.3, emojis-list@2.1.0, json5@0.5.0)
├── enhanced-resolve@0.9.1 (graceful-fs@4.1.9, memory-fs@0.2.0)
├── mkdirp@0.5.1 (minimist@0.0.8)
├── acorn@3.3.0
├── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
├── memory-fs@0.3.0 (errno@0.1.4, readable-stream@2.1.5)
├── webpack-core@0.6.8 (source-map@0.4.4, source-list-map@0.1.6)
├── uglify-js@2.6.4 (async@0.2.10, uglify-to-browserify@1.0.2, source-map@0.5.6, yargs@3.10.0)
├── watchpack@0.2.9 (graceful-fs@4.1.9, async@0.9.2, chokidar@1.6.0)
└── node-libs-browser@0.6.0 (https-browserify@0.0.0, tty-browserify@0.0.0, path-browserify@0.0.0, constants-browserify@0
.0.1, punycode@1.4.1, string_decoder@0.10.31, os-browserify@0.1.2, process@0.11.9, assert@1.4.1, domain-browser@1.1.7, q
uerystring-es3@0.2.1, timers-browserify@1.4.2, stream-browserify@1.0.0, events@1.1.1, vm-browserify@0.0.4, util@0.10.3,
console-browserify@1.1.0, readable-stream@1.1.14, url@0.10.3, http-browserify@1.7.0, buffer@4.9.1, browserify-zlib@0.1.4
, crypto-browserify@3.2.8)

css-loader@0.23.1 node_modules\css-loader
├── postcss-modules-extract-imports@1.0.1
├── object-assign@4.1.0
├── loader-utils@0.2.16 (big.js@3.1.3, emojis-list@2.1.0, json5@0.5.0)
├── postcss-modules-values@1.2.2 (icss-replace-symbols@1.0.2)
├── css-selector-tokenizer@0.5.4 (fastparse@1.1.1, cssesc@0.1.0)
├── source-list-map@0.1.6
├── lodash.camelcase@3.0.1 (lodash._createcompounder@3.0.0)
├── postcss-modules-scope@1.0.2 (css-selector-tokenizer@0.6.0)
├── postcss-modules-local-by-default@1.1.1 (css-selector-tokenizer@0.6.0)
├── postcss@5.2.4 (js-base64@2.1.9, source-map@0.5.6, chalk@1.1.3, supports-color@3.1.2)
└── cssnano@3.7.6 (decamelize@1.2.0, postcss-normalize-charset@1.1.0, postcss-reduce-transforms@1.0.3, postcss-minify-gr
adients@1.0.3, postcss-discard-empty@2.1.0, postcss-discard-duplicates@2.0.1, postcss-merge-idents@2.1.7, postcss-reduce
-initial@1.0.0, postcss-convert-values@2.4.1, postcss-reduce-idents@2.3.0, postcss-discard-comments@2.0.4, defined@1.0.0
, postcss-value-parser@3.3.0, postcss-minify-font-values@1.0.5, postcss-discard-overridden@0.1.1, postcss-ordered-values
@2.2.2, postcss-zindex@2.1.1, postcss-discard-unused@2.2.1, postcss-minify-params@1.0.5, postcss-unique-selectors@2.0.2,
 postcss-merge-longhand@2.0.1, postcss-merge-rules@2.0.10, has@1.0.1, postcss-normalize-url@3.0.7, postcss-filter-plugin
s@2.0.2, postcss-minify-selectors@2.0.5, postcss-calc@5.3.1, postcss-colormin@2.2.1, postcss-svgo@2.1.5, autoprefixer@6.
5.0)

react@15.3.2 node_modules\react
├── object-assign@4.1.0
├── loose-envify@1.2.0 (js-tokens@1.0.3)
└── fbjs@0.8.5 (immutable@3.8.1, ua-parser-js@0.7.10, promise@7.1.1, isomorphic-fetch@2.2.1, core-js@1.2.7)

babel-core@6.17.0 node_modules\babel-core
├── slash@1.0.0
├── babel-messages@6.8.0
├── babel-template@6.16.0
├── shebang-regex@1.0.0
├── path-exists@1.0.0
├── path-is-absolute@1.0.1
├── babel-helpers@6.16.0
├── private@0.1.6
├── convert-source-map@1.3.0
├── source-map@0.5.6
├── debug@2.2.0 (ms@0.7.1)
├── babylon@6.11.4
├── babel-types@6.16.0 (to-fast-properties@1.0.2, esutils@2.0.2)
├── minimatch@3.0.3 (brace-expansion@1.1.6)
├── babel-code-frame@6.16.0 (js-tokens@2.0.0, esutils@2.0.2, chalk@1.1.3)
├── babel-traverse@6.16.0 (globals@8.18.0, invariant@2.2.1)
├── babel-generator@6.17.0 (jsesc@1.3.0, detect-indent@3.0.1)
├── json5@0.4.0
├── lodash@4.16.3
├── babel-register@6.16.3 (home-or-tmp@1.0.0, source-map-support@0.4.3, mkdirp@0.5.1, core-js@2.4.1)
└── babel-runtime@6.11.6 (regenerator-runtime@0.9.5, core-js@2.4.1)

babel-preset-react@6.16.0 node_modules\babel-preset-react
├── babel-plugin-syntax-flow@6.13.0
├── babel-plugin-syntax-jsx@6.13.0
├── babel-plugin-transform-react-jsx-self@6.11.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-react-jsx-source@6.9.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-react-display-name@6.8.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-flow-strip-types@6.14.0 (babel-runtime@6.11.6)
└── babel-plugin-transform-react-jsx@6.8.0 (babel-helper-builder-react-jsx@6.9.0, babel-runtime@6.11.6)

babel-preset-es2015@6.16.0 node_modules\babel-preset-es2015
├── babel-plugin-transform-es2015-spread@6.8.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-object-super@6.8.0 (babel-helper-replace-supers@6.16.0, babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-for-of@6.8.0 (babel-runtime@6.11.6)
├── babel-plugin-check-es2015-constants@6.8.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-literals@6.8.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-destructuring@6.16.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-function-name@6.9.0 (babel-types@6.16.0, babel-helper-function-name@6.8.0, babel-runti
me@6.11.6)
├── babel-plugin-transform-es2015-arrow-functions@6.8.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-modules-amd@6.8.0 (babel-template@6.16.0, babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-template-literals@6.8.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-computed-properties@6.8.0 (babel-helper-define-map@6.9.0, babel-template@6.16.0, babel
-runtime@6.11.6)
├── babel-plugin-transform-es2015-modules-systemjs@6.14.0 (babel-template@6.16.0, babel-helper-hoist-variables@6.8.0, ba
bel-runtime@6.11.6)
├── babel-plugin-transform-es2015-sticky-regex@6.8.0 (babel-helper-regex@6.9.0, babel-types@6.16.0, babel-runtime@6.11.6
)
├── babel-plugin-transform-es2015-typeof-symbol@6.8.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-modules-umd@6.12.0 (babel-template@6.16.0, babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-modules-commonjs@6.16.0 (babel-plugin-transform-strict-mode@6.11.3, babel-template@6.1
6.0, babel-types@6.16.0, babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-duplicate-keys@6.8.0 (babel-types@6.16.0, babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-unicode-regex@6.11.0 (regexpu-core@2.0.0, babel-helper-regex@6.9.0, babel-runtime@6.11
.6)
├── babel-plugin-transform-es2015-shorthand-properties@6.8.0 (babel-types@6.16.0, babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-block-scoped-functions@6.8.0 (babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-block-scoping@6.15.0 (babel-types@6.16.0, babel-template@6.16.0, babel-traverse@6.16.0
, lodash@4.16.3, babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-classes@6.14.0 (babel-helper-replace-supers@6.16.0, babel-helper-optimise-call-express
ion@6.8.0, babel-messages@6.8.0, babel-helper-function-name@6.8.0, babel-helper-define-map@6.9.0, babel-template@6.16.0,
 babel-types@6.16.0, babel-traverse@6.16.0, babel-runtime@6.11.6)
├── babel-plugin-transform-es2015-parameters@6.17.0 (babel-helper-get-function-arity@6.8.0, babel-helper-call-delegate@6
.8.0, babel-template@6.16.0, babel-types@6.16.0, babel-traverse@6.16.0, babel-runtime@6.11.6)
└── babel-plugin-transform-regenerator@6.16.1 (private@0.1.6, babel-types@6.16.0, babel-runtime@6.11.6)

Then run npm run build Results:

> NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress --profile --colors

'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run
" "build"
npm ERR! node v4.2.6
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! factorio-mod-manager@0.1.0 build: `NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress --profi
le --colors`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the factorio-mod-manager@0.1.0 build script 'NODE_ENV=production ./node_modules/webpack/bin/webpack.j
s --progress --profile --colors'.
npm ERR! This is most likely a problem with the factorio-mod-manager package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress --profile --colors
npm ERR! You can get their info via:
npm ERR!     npm owner ls factorio-mod-manager
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\kevin\Downloads\factorio-server-manager-0.4.3\ui\npm-debug.log

npm-debug log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using npm@2.14.12
3 info using node@v4.2.6
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info prebuild factorio-mod-manager@0.1.0
6 info build factorio-mod-manager@0.1.0
7 verbose unsafe-perm in lifecycle true
8 info factorio-mod-manager@0.1.0 Failed to exec build script
9 verbose stack Error: factorio-mod-manager@0.1.0 build: `NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress --profile --colors`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (C:\Users\kevin\AppData\Roaming\nvm\v4.2.6\node_modules\npm\lib\utils\lifecycle.js:214:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (C:\Users\kevin\AppData\Roaming\nvm\v4.2.6\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:821:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid factorio-mod-manager@0.1.0
11 verbose cwd C:\Users\kevin\Downloads\factorio-server-manager-0.4.3\ui
12 error Windows_NT 10.0.10586
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
14 error node v4.2.6
15 error npm  v2.14.12
16 error code ELIFECYCLE
17 error factorio-mod-manager@0.1.0 build: `NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress --profile --colors`
17 error Exit status 1
18 error Failed at the factorio-mod-manager@0.1.0 build script 'NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress --profile --colors'.
18 error This is most likely a problem with the factorio-mod-manager package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress --profile --colors
18 error You can get their info via:
18 error     npm owner ls factorio-mod-manager
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
mroote commented 7 years ago

It looks like the build command on Windows doesn't like that NODE_ENV environment variable. You can just remove it from the command in the package.json file and it should build.

ghost commented 7 years ago

So in ui directory in that json file make it look like so?

{
  "name": "factorio-mod-manager",
  "version": "0.1.0",
  "description": "Factorio Mod Manager UI",
  "main": "index.js",
  "scripts": {
    "build": "./node_modules/webpack/bin/webpack.js --progress --profile --colors",
    "dev": "./node_modules/webpack/bin/webpack.js -w --progress --profile --colors",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Mitch Roote <mitch@r00t.ca>",
  "license": "MIT",
  "dependencies": {
    "babel-core": "^6.4.5",
    "babel-loader": "^6.2.1",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "react": "^15.0.1",
    "react-dom": "^15.0.1",
    "react-router": "^2.3.0",
    "sweetalert": "^1.1.3"
  },
  "devDependencies": {
    "css-loader": "^0.23.1",
    "style-loader": "^0.13.1",
    "webpack": "^1.13.0"
  }
}

Results in:

> factorio-mod-manager@0.1.0 build C:\Users\kevin\Downloads\factorio-server-manager\ui
> ./node_modules/webpack/bin/webpack.js --progress --profile --colors

'.' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run
" "build"
npm ERR! node v4.2.6
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! factorio-mod-manager@0.1.0 build: `./node_modules/webpack/bin/webpack.js --progress --profile --colors`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the factorio-mod-manager@0.1.0 build script './node_modules/webpack/bin/webpack.js --progress --profi
le --colors'.
npm ERR! This is most likely a problem with the factorio-mod-manager package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ./node_modules/webpack/bin/webpack.js --progress --profile --colors
npm ERR! You can get their info via:
npm ERR!     npm owner ls factorio-mod-manager
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\kevin\Downloads\factorio-server-manager\ui\npm-debug.log

Log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using npm@2.14.12
3 info using node@v4.2.6
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info prebuild factorio-mod-manager@0.1.0
6 info build factorio-mod-manager@0.1.0
7 verbose unsafe-perm in lifecycle true
8 info factorio-mod-manager@0.1.0 Failed to exec build script
9 verbose stack Error: factorio-mod-manager@0.1.0 build: `node_modules/webpack/bin/webpack.js --progress --profile --colors`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (C:\Users\kevin\AppData\Roaming\nvm\v4.2.6\node_modules\npm\lib\utils\lifecycle.js:214:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (C:\Users\kevin\AppData\Roaming\nvm\v4.2.6\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:821:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid factorio-mod-manager@0.1.0
11 verbose cwd C:\Users\kevin\Downloads\factorio-server-manager\ui
12 error Windows_NT 10.0.10586
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
14 error node v4.2.6
15 error npm  v2.14.12
16 error code ELIFECYCLE
17 error factorio-mod-manager@0.1.0 build: `node_modules/webpack/bin/webpack.js --progress --profile --colors`
17 error Exit status 1
18 error Failed at the factorio-mod-manager@0.1.0 build script 'node_modules/webpack/bin/webpack.js --progress --profile --colors'.
18 error This is most likely a problem with the factorio-mod-manager package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     node_modules/webpack/bin/webpack.js --progress --profile --colors
18 error You can get their info via:
18 error     npm owner ls factorio-mod-manager
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
bostelk commented 7 years ago

There are various solutions documented here: http://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-in-windows

ghost commented 7 years ago

Thanks, made the json lines with set NODE_ENV="production"... No error log powershell just outputs this

PS C:\Users\kevin\Downloads\factorio-server-manager\ui> npm run build

> factorio-mod-manager@0.1.0 build C:\Users\kevin\Downloads\factorio-server-manager\ui
> set NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress --profile --colors

Not sure if I have to do anything else. However, then opening the exe from go build just does the same thing:

C:\Users\kevin\Downloads\factorio-server-manager\src>src --host localhost
2016/10/04 21:51:06 Created initial user: admin
2016/10/04 21:51:06 Could not create modpacks directory: mkdir modpacks: Cannot create a file when that file already exists.
Starting server on: localhost:8080

I assume the "server" is the webserver for the manager as it won't have the input for where the factorio folder is etc.

EDIT:

After trying the npm again I'm getting this:

C:\Users\kevin\Downloads\factorio-server-manager\ui>npm run build
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v4.2.6
npm ERR! npm  v2.14.12
npm ERR! file C:\Users\kevin\Downloads\factorio-server-manager\ui\package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token 'r' at 7:30
npm ERR!     "build": "set NODE_ENV="production" ./node_modules/webpack/bin/webpack.js -
npm ERR!                              ^
npm ERR! File: C:\Users\kevin\Downloads\factorio-server-manager\ui\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\kevin\Downloads\factorio-server-manager\ui\npm-debug.log

C:\Users\kevin\Downloads\factorio-server-manager\ui>npm run build

> factorio-mod-manager@0.1.0 build C:\Users\kevin\Downloads\factorio-server-manager\ui
> set NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress --profile --colors

Just want to say sorry for all of this back and forth. I'm quite sure this is all user error as most things are. So thanks for all the help so far. I just wish I knew where I was going wrong.

ghost commented 7 years ago

FINALLY! This did the trick: "build": "set NODE_ENV=production&&node ./node_modules/webpack/bin/webpack.js --progress --profile --colors",

Now where do I put the src.exe from the go build process? Because when I run it with src --host localhost --port 9191 --dir E:\Steam\steamapps\common\Factorio\bin\x64\ it runs but when i goto that address it 404's but not the generic one chrome does just small text. I just have it in the same folder it was built from C:\FS\factorio-server-manager\src This is all that happens:

C:\FS\factorio-server-manager\src>src --host localhost --port 9191 --dir E:\Steam\steamapps\common\Factorio\bin\x64\
2016/10/04 23:05:10 Created user: admin
Starting server on: localhost:9191
C:\FS\factorio-server-manager\ui>npm run build

> factorio-mod-manager@0.1.0 build C:\FS\factorio-server-manager\ui
> set NODE_ENV=production&&node ./node_modules/webpack/bin/webpack.js --progress --profile --colors

15507ms build modules
7ms seal
9ms optimize
8ms hashing
25ms create chunk assets
3ms additional chunk assets
2ms optimize chunk assets
2ms optimize assets
17ms emit
Hash: 6746434bdc58b6a9533d
Version: webpack 1.13.2
Time: 15610ms
    Asset     Size  Chunks             Chunk Names
bundle.js  1.17 MB       0  [emitted]  main
    + 270 hidden modules
bostelk commented 7 years ago

The executable needs to be in the root directory. Eg. C:\FS\factorio-server-manager\src.exe

xeroiv commented 7 years ago

Now document it on the wiki :-)

On Oct 4, 2016 10:55 PM, "cyris69" notifications@github.com wrote:

FINALLY!

C:\FS\factorio-server-manager\ui>npm run build

factorio-mod-manager@0.1.0 build C:\FS\factorio-server-manager\ui set NODE_ENV=production&&node ./node_modules/webpack/bin/webpack.js --progress --profile --colors

15507ms build modules 7ms seal 9ms optimize 8ms hashing 25ms create chunk assets 3ms additional chunk assets 2ms optimize chunk assets 2ms optimize assets 17ms emit Hash: 6746434bdc58b6a9533d Version: webpack 1.13.2 Time: 15610ms Asset Size Chunks Chunk Names bundle.js 1.17 MB 0 [emitted] main

  • 270 hidden modules

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MajorMJR/factorio-server-manager/issues/37#issuecomment-251569702, or mute the thread https://github.com/notifications/unsubscribe-auth/AGUcB-sfvk3ODByh4l60JHeTqYwxFyg0ks5qwxGjgaJpZM4JRHkV .

ghost commented 7 years ago

Ok, its working now. I was getting a bunch of errors starting and creating/uploading saves. Then I read the cmd window and noticed it was trying to go to E:\Steam\steamapps\common\Factorio\bin\x64\bin\x64 So I swapped the --dir to E:\Steam\steamapps\common\Factorio\ and it worked.

The version of the game I'm running is 0.14.12 and I think they did away with '--autosave-interval' As it fails due to unrecognised option '--autosave-interval'

C:\FS\factorio-server-manager>src --host localhost --port 9191 --dir E:\Steam\steamapps\common\Factorio\
2016/10/05 10:38:23 Created user: admin
Starting server on: localhost:91912016/10/05 10:38:25 Server not running, creating status response: {true map[status:stopped]}
2016/10/05 10:38:25 Error listing save directory: open E:\Steam\steamapps\common\Factorio\saves: The system cannot find the file specified.
2016/10/05 10:38:25 Server not running, creating status response: {true map[status:stopped]}
2016/10/05 10:38:27 Server not running, creating status response: {true map[status:stopped]}
2016/10/05 10:38:27 Error listing save directory: open E:\Steam\steamapps\common\Factorio\saves: The system cannot find the file specified.
   0.003 2016-10-05 10:38:33; Factorio 0.14.12 (build 24932, win64, steam)
   0.005 Operating system: Windows 10
   0.006 Program arguments: "E:\Steam\steamapps\common\Factorio\bin\x64\factorio" "--create" "E:\Steam\steamapps\common\Factorio\saves\server"
   0.010 Read data path: E:/Steam/steamapps/common/Factorio/data
   0.012 Write data path: C:/Users/kevin/AppData/Roaming/Factorio
   0.014 Binaries path: E:/Steam/steamapps/common/Factorio/bin
   0.030 System info: [CPU: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz, 12 cores, RAM: 32707MB]
   0.033 Running in headless mode
   0.039 Loading mod core 0.0.0 (data.lua)
   0.047 Loading mod base 0.14.12 (data.lua)
   0.202 Checksum for core: 1620335853
   0.202 Checksum for mod base: 2833886813
   0.531 Info PlayerData.cpp:55: Local player-data.json available, timestamp 1475622965
   0.533 Info PlayerData.cpp:62: Cloud player-data.json unavailable
   0.543 Custom inputs active: 0
   0.547 Factorio initialised
   0.548 Info Main.cpp:598: Creating new map E:\Steam\steamapps\common\Factorio\saves\server
   2.591 Info Scenario.cpp:152: Map version 0.14.12-1
   2.633 Checksum for script C:/Users/kevin/AppData/Roaming/Factorio/temp/currently-playing/control.lua: 900459546
Done.
2016/10/05 10:38:43 Server not running, creating status response: {true map[status:stopped]}
2016/10/05 10:38:43 Server not running, creating status response: {true map[status:stopped]}
2016/10/05 10:38:45 Starting Factorio server.
2016/10/05 10:38:45 Starting Factorio server with settings: {"savefile":"server.zip","latency":100,"autosave_interval":5,"autosave_slots":10,"port":34197,"disallow_cmd":false,"peer2peer":false,"auto_pause":false}
2016/10/05 10:38:45 Starting server with command:  E:\Steam\steamapps\common\Factorio\bin\x64\factorio [--start-server E:\Steam\steamapps\common\Factorio\saves\server.zip --autosave-interval 5 --autosave-slots 10 --port 34197]
   0.000  Error Util.cpp:57: unrecognised option '--autosave-interval'
2016/10/05 10:38:46 Factorio server started on port: 34197
2016/10/05 10:38:46 Creating server status response
2016/10/05 10:38:46 Server status sent with data: map[status:running port:34197 savefile:server.zip]
2016/10/05 10:38:46 Creating server status response
2016/10/05 10:38:46 Server status sent with data: map[status:running port:34197 savefile:server.zip]
unrecognised option '--autosave-interval'

General options:
  -h [ --help ]                      display help
  --version                          show version information
  -v [ --verbose ]                   enable verbose logging
  -c [ --config ] PATH               config file to use
  --no-log-rotation                  don't rotate log file
  --mod-directory PATH               Mod directory to use

Running options:
  -s [ --map2scenario ] arg          map to scenario conversion
  -m [ --scenario2map ] arg          scenario to map conversion
  --apply-update arg                 immediately apply update package
  --create FILE                      create a new map
  --map-gen-settings FILE            Map generation settings for use with
                                     --create. See data/map-gen-settings.exampl
                                     e.json
  --start-server FILE                start a multiplayer server
  --start-server-load-scenario FILE  start a multiplayer server and load the
                                     specified scenario
  --start-server-load-latest         start a multiplayer server and load the
                                     latest available save
  --until-tick TICK                  run a save until given map tick
  --mp-connect ADDRESS               start factorio and connect to address
  --load-game FILE                   start Factorio and load a game in
                                     singleplayer
  --benchmark FILE                   load save and run benchmark
  --benchmark-ticks N (=1,000)       number of ticks for benchmarking. Default
                                     is 1000
  --force-opengl                     use OpenGL for rendering
  --force-d3d                        use Direct3D for rendering
  --fullscreen BOOL                  start game in windowed mode (saved to
                                     configuration)
  --max-texture-size N               maximal size of texture that the game can
                                     use (saved to configuration). Should be
                                     power of two greater than 2048
  --graphics-quality arg             accepted values: normal, low, very-low
  --video-memory-usage arg           accepted values: all, high, medium, low
  --gfx-safe-mode                    resets some graphics settings to values
                                     that should work on most configurations

Server options:
  --port N                           network port to use
  --rcon-port N                      Port to use for RCON
  --rcon-password PASSWORD           Password for RCON
  --server-settings FILE             Path to file with server settings. See
                                     data/server-settings.example.json

2016/10/05 10:39:06 Command exited with error: exit status 1
2016/10/05 10:39:06 Error starting Factorio server: exit status 1
2016/10/05 10:39:29 Creating server status response
2016/10/05 10:39:29 Server status sent with data: map[port:34197 savefile:server.zip status:running]
2016/10/05 10:39:29 listing users: 1 found
2016/10/05 10:39:30 Loading config file: E:\Steam\steamapps\common\Factorio\config\config.ini
2016/10/05 10:39:30 Error loading config.ini file: open E:\Steam\steamapps\common\Factorio\config\config.ini: The system cannot find the path specified.
2016/10/05 10:39:30 Could not retrieve config.ini: open E:\Steam\steamapps\common\Factorio\config\config.ini: The system cannot find the path specified.
2016/10/05 10:39:45 Creating server status response
2016/10/05 10:39:45 Server status sent with data: map[savefile:server.zip status:running port:34197]
2016/10/05 10:39:45 Creating server status response
2016/10/05 10:39:45 Server status sent with data: map[port:34197 savefile:server.zip status:running]
2016/10/05 10:39:46 Error sending SIGINT to Factorio process: invalid argument
2016/10/05 10:39:46 Error in stop server handler: invalid argument
2016/10/05 10:39:46 Creating server status response
2016/10/05 10:39:46 Server status sent with data: map[port:34197 savefile:server.zip status:running]
2016/10/05 10:39:46 Creating server status response
2016/10/05 10:39:46 Server status sent with data: map[status:running port:34197 savefile:server.zip]
2016/10/05 10:42:18 Creating server status response
2016/10/05 10:42:18 Server status sent with data: map[status:running port:34197 savefile:server.zip]
2016/10/05 10:42:18 Creating server status response
2016/10/05 10:42:18 Server status sent with data: map[savefile:server.zip status:running port:34197]
2016/10/05 10:42:20 Creating server status response
2016/10/05 10:42:20 Server status sent with data: map[status:running port:34197 savefile:server.zip]
2016/10/05 10:42:20 listing users: 1 found
ghost commented 7 years ago

I had to remove

"--autosave-interval", strconv.Itoa(f.AutosaveInterval),
"--autosave-slots", strconv.Itoa(f.AutosaveSlots),

From server.go and re-compile.

ghost commented 7 years ago

Only a few issue left, no idea if it is indeed saving. Game configuration aka http://localhost:9191/config is empty. I can not adjust latency besides in go file and compiling. I'd like to be able to password protect as well as make sure it pauses when no one is online.

I didn't see a default config.ini so read log and created config/config.ini. It loads and says its doing something to the config but no .json is created or any fields online.

2016/10/05 14:05:03 Loading config file: C:\FS\config\config.ini
2016/10/05 14:05:03 Appending sections [DEFAULT] to JSON response
2016/10/05 14:05:03 Encoding config.ini to JSON
2016/10/05 14:05:03 Sent config.ini response
mroote commented 7 years ago

Yeah the Factorio directory flag should point to the general Factorio directory and not the bin/x64 folder.

I have to make some updates for version 0.14 as they have changed around many of the launch parameters. There's also a new config file for multiplayer servers that would be useful to add the ability to edit from the server manager.

ghost commented 7 years ago

Care to link to the server config? I pulled up some old one from 12.x builds but couldn't find a recent which does now show up in the manager properly now.

Also Ctrl + C in the command window does indeed save the game and update the save zip properly on Windows btw.

I used to help teach VB in college (10 years ago lol) and have background in C++ if you need someone to help with simpler tasks. Plus what I don't know I could Google and figure out. Or if you need someone to update process/usage documentation or wiki etc.

mroote commented 7 years ago

There's a config.ini file in the factorio/config directory but now there is another config file if you host a multiplayer server that contains settings such as slots, autosave-interval etc. By default it's called server-settings.json or something similar.

So I'll have to add some ability to manage this file as it contains most of the settings for a multiplayer Factorio server now.

ghost commented 7 years ago

I was wondering if for Windows you could just do a terminate batch command or pass a ctrl C to console or something to fix the stop server issue. That way it still save but is also killed.

I also haven't managed to get the port to forward for the manager itself. I've added it to my servers firewall as well as factorio.exe. the. Forwarded the game and manger port properly in my ddwrt router. If you have advice on that I'd appreciate it. Also sorry for hijacking this thread.

ghost commented 7 years ago

I also didn't find this said updated ini file for whatever reason. At least the one I have doesn't have any important information besides server port.

EDIT:

Also updated the readme file not sure how that works to get finalized, I did note some errors I made that need fixed and not sure how to do that either https://github.com/MajorMJR/factorio-server-manager/commit/daca17a432b06efd9a0fef466c8160c604555060