inolen / quakejs

1.47k stars 199 forks source link

repak.js is broken on newer node installs #69

Open glennhartmann opened 4 years ago

glennhartmann commented 4 years ago

running it results in errors that look like this:

node_modules/temp/lib/temp.js:142
exports.dir               = os.tmpDir();
                               ^

TypeError: os.tmpDir is not a function
    at Object.<anonymous> (node_modules/temp/lib/temp.js:142:32)
    at Module._compile (internal/modules/cjs/loader.js:1076:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:941:32)
    at Function.Module._load (internal/modules/cjs/loader.js:782:14)
    at Module.require (internal/modules/cjs/loader.js:965:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (node_modules/execSync/index.js:6:12)
    at Module._compile (internal/modules/cjs/loader.js:1076:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)

due to the temp package being too old and trying to call os.tmpDir() instead of the newer os.tmpdir().

Fixing that locally then results in further errors:

internal/modules/cjs/loader.js:896
  throw err;
  ^

Error: Cannot find module './build/Release/shell'
Require stack:
- node_modules/execSync/index.js
- bin/repak.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:893:15)
    at Function.Module._load (internal/modules/cjs/loader.js:743:27)
    at Module.require (internal/modules/cjs/loader.js:965:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (node_modules/execSync/index.js:30:11)
    at Module._compile (internal/modules/cjs/loader.js:1076:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:941:32)
    at Function.Module._load (internal/modules/cjs/loader.js:782:14)
    at Module.require (internal/modules/cjs/loader.js:965:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [                                                                                                                                                                      
    'node_modules/execSync/index.js',
    'bin/repak.js'
  ]
}

The execSync package is no longer supported, and can be replaced with built-in child_process.execSync.

ghost commented 4 years ago

There are other problems deeper in. https://github.com/inolen/quakejs-files/issues/2 And someone PRed a change that uses some internal buffer on the file stream and that no longer works. Use my repack on latest commit, cli options are extensive and in the readme and available with npm run repack -- -h https://github.com/briancullinan/planet_quake/blob/checksum_spoofing/code/xquakejs/bin/repack.js#L23

npm run repack -- --no-graph --pk3dir ~/baseq3 is common for me.

Requires image magick and ogg encoder.