tobspr-games / shapez.io

shapez is an open source base building game on Steam inspired by factorio!
https://get.shapez.io/gh
GNU General Public License v3.0
6.37k stars 1.22k forks source link

Unknown error from PostCSS plugin. #1051

Closed 9p4 closed 3 years ago

9p4 commented 3 years ago

After cloning the git repo and checking out the 1.2.2 branch, I tried to build a standalone binary on Linux (tried on Arch Linux, Ubuntu 20.04), but I got an error when running the build. This is what I run:

$ git clone --recursive https://github.com/tobspr/shapez.io
$ cd shapez.io
$ yarn
$ cd electron; yarn; cd ..
$ cd gulp; yarn
$ yarn gulp build.standalone-prod
yarn run v1.22.10
? gulp build.standalone-prod
Please set SHAPEZ_CLI_SERVER_HOST
Please set SHAPEZ_CLI_ALPHA_FTP_USER
Please set SHAPEZ_CLI_ALPHA_FTP_PW
Please set SHAPEZ_CLI_STAGING_FTP_USER
Please set SHAPEZ_CLI_STAGING_FTP_PW
Please set SHAPEZ_CLI_LIVE_FTP_USER
Please set SHAPEZ_CLI_LIVE_FTP_PW
Please set SHAPEZ_CLI_APPLE_ID
Please set SHAPEZ_CLI_APPLE_CERT_NAME
Please set SHAPEZ_CLI_GITHUB_USER
Please set SHAPEZ_CLI_GITHUB_TOKEN
[15:01:48] Using gulpfile ~/Downloads/shapez.io/gulp/gulpfile.js
[15:01:48] Starting 'build.standalone-prod'...
[15:01:48] Starting 'utils.cleanup'...
[15:01:48] Starting 'utils.cleanBuildFolder'...
[15:01:48] Finished 'utils.cleanBuildFolder' after 47 ms
[15:01:48] Starting 'utils.cleanImageBuildFolder'...
[15:01:48] Finished 'utils.cleanImageBuildFolder' after 3.49 ms
[15:01:48] Starting 'utils.cleanBuildTempFolder'...
[15:01:48] Finished 'utils.cleanBuildTempFolder' after 7.99 ms
[15:01:48] Finished 'utils.cleanup' after 59 ms
[15:01:48] Starting 'step.standalone-prod.all'...
[15:01:48] Starting 'step.standalone-prod.mainbuild'...
[15:01:48] Starting 'step.baseResources'...
[15:01:48] Starting 'step.standalone-prod.code'...
[15:01:48] Starting 'imgres.allOptimized'...
[15:01:48] Starting 'sounds.fullbuildHQ'...
[15:01:48] Starting 'imgres.buildAtlas'...
[15:01:48] Starting 'imgres.atlasToJson'...
[15:01:48] Starting 'imgres.atlasOptimized'...
[15:01:48] Starting 'imgres.copyNonImageResources'...
[15:01:48] Starting 'imgres.copyImageResourcesOptimized'...
[15:01:48] Starting 'sounds.clear'...
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12)
OpenJDK 64-Bit Server VM (build 14.0.2+12, mixed mode)
[15:01:53] Finished 'imgres.buildAtlas' after 4.76 s
Processing: /home/username/shapez.io/res_built/atlas/atlas0_hq.atlas
Processing: /home/username/shapez.io/res_built/atlas/atlas0_lq.atlas
Processing: /home/username/shapez.io/res_built/atlas/atlas0_mq.atlas
[15:01:53] Finished 'imgres.atlasToJson' after 4.77 s
[15:01:53] Finished 'sounds.clear' after 5.06 s
[15:01:53] Starting 'sounds.buildallHQ'...
[15:01:53] Starting 'sounds.musicHQ'...
[15:01:53] Starting 'sounds.sfx'...
[15:01:53] Starting 'sounds.sfxGenerateSprites'...
[15:01:53] gulp-imagemin: Minified 0 images
[15:01:53] Finished 'imgres.copyNonImageResources' after 5.2 s
[
  '/home/username/shapez.io/res_raw/sounds/sfx/badge_notification.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/copy.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/destroy_building.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/dialog_error.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/dialog_ok.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/level_complete.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/place_belt.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/place_building.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/ui_click.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/ui_error.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/ui_swish_hide.wav',
  '/home/username/shapez.io/res_raw/sounds/sfx/ui_swish_show.wav'
] undefined
File added OK {
  file: '/tmp/audiosprite.3210745427640429',
  duration: 0.9675283446712019
}
Silence gap added { duration: 0.13247165532879815 }
File added OK {
  file: '/tmp/audiosprite.3193927171549471',
  duration: 0.18081632653061225
}
Silence gap added { duration: 0.9191836734693878 }
File added OK {
  file: '/tmp/audiosprite.2179681305979948',
  duration: 0.4672108843537415
}
Silence gap added { duration: 0.6327891156462585 }
File added OK {
  file: '/tmp/audiosprite.17574778708972905',
  duration: 0.19507936507936507
}
Silence gap added { duration: 0.9049206349206349 }
File added OK {
  file: '/tmp/audiosprite.7604322254677445',
  duration: 0.8804535147392291
}
Silence gap added { duration: 0.21954648526077095 }
File added OK {
  file: '/tmp/audiosprite.4917987080708819',
  duration: 2.119387755102041
}
Silence gap added { duration: 0.980612244897959 }
File added OK {
  file: '/tmp/audiosprite.16638679328961814',
  duration: 0.06380952380952382
}
Silence gap added { duration: 1.0361904761904763 }
File added OK {
  file: '/tmp/audiosprite.08275106657277731',
  duration: 0.30984126984126986
}
Silence gap added { duration: 0.7901587301587302 }
File added OK {
  file: '/tmp/audiosprite.4238499790482053',
  duration: 0.11297052154195011
}
Silence gap added { duration: 0.9870294784580499 }
File added OK {
  file: '/tmp/audiosprite.7954973811498116',
  duration: 0.3057369614512472
}
Silence gap added { duration: 0.7942630385487528 }
File added OK {
  file: '/tmp/audiosprite.07948132766689042',
  duration: 0.08541950113378685
}
Silence gap added { duration: 1.0145804988662133 }
File added OK {
  file: '/tmp/audiosprite.49518545028924676',
  duration: 0.1127891156462585
}
Silence gap added { duration: 0.9872108843537415 }
Exported mp3 OK { file: '/tmp/sfx.mp3' }
[15:01:57] Finished 'sounds.musicHQ' after 4.5 s
[15:01:57] Finished 'sounds.sfxGenerateSprites' after 4.52 s
[15:01:57] Starting 'sounds.sfxOptimize'...
[15:01:58] Finished 'sounds.sfxOptimize' after 397 ms
[15:01:58] Starting 'sounds.sfxCopyAtlas'...
[15:01:58] Finished 'sounds.sfxCopyAtlas' after 6.48 ms
[15:01:58] Finished 'sounds.sfx' after 4.94 s
[15:01:58] Finished 'sounds.buildallHQ' after 4.94 s
[15:01:58] Starting 'sounds.copy'...
[15:01:58] Finished 'sounds.copy' after 223 ms
[15:01:58] Finished 'sounds.fullbuildHQ' after 10 s
[15:01:58] Starting 'translations.fullBuild'...
[15:01:58] Starting 'translations.convertToJson'...
[15:01:58] Finished 'translations.convertToJson' after 441 ms
[15:01:58] Finished 'translations.fullBuild' after 442 ms
[15:01:58] Starting 'js.standalone-prod'...
(node:736681) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
(Use `node --trace-deprecation ...` to show where the warning was created)
[15:02:04] gulp-imagemin: Minified 3 images (saved 2.34 MB - 76.7%)
[15:02:04] Finished 'imgres.atlasOptimized' after 16 s
[15:02:13] gulp-imagemin: Minified 2 images (saved 4.76 kB - 52%)
[15:02:15] gulp-imagemin: Minified 173 images (saved 4.88 MB - 35.6%)
[15:02:15] Finished 'imgres.copyImageResourcesOptimized' after 27 s
[15:02:15] Finished 'imgres.allOptimized' after 27 s
[15:02:15] Finished 'step.baseResources' after 27 s
[15:02:24] Version: webpack 4.44.2
Built at: 01/05/2021 3:02:23 PM
    Asset      Size  Chunks             Chunk Names
bundle.js  1.35 MiB       0  [emitted]  bundle.js
Entrypoint bundle.js = bundle.js
Child worker:
     1 asset
    Entrypoint main = c33241889891a3fc8744.worker.js
Child worker:
     1 asset
    Entrypoint main = d353a1e736997734d401.worker.js
[15:02:24] Finished 'js.standalone-prod' after 25 s
[15:02:24] Finished 'step.standalone-prod.code' after 36 s
[15:02:24] Finished 'step.standalone-prod.mainbuild' after 36 s
[15:02:24] Starting 'css.prod-standalone'...
[15:02:24] Starting 'css.main.prod-standalone'...
[15:02:24] Starting 'css.resources.prod-standalone'...
postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
Unknown error from PostCSS plugin. Your current PostCSS version is 7.0.35, but postcss-unprefix uses 8.2.2. Perhaps this is the source of the error below.
[15:02:29] Plumber found unhandled error:
 TypeError in plugin "gulp-postcss"
Message:
    Cannot read property 'unprefixed' of undefined
Details:
    postcssNode: -webkit-tap-highlight-color: rgba(255, 255, 255, 0)
    fileName: /home/username/shapez.io/src/css/main.css

Stack:
TypeError: Cannot read property 'unprefixed' of undefined
    at /home/username/shapez.io/src/css/main.css:43:3
    at clearDecl (/home/username/shapez.io/gulp/node_modules/postcss-unprefix/lib/clearDecl.js:13:30)
    at walkDecl (/home/username/shapez.io/gulp/node_modules/postcss-unprefix/lib/clearDecl.js:7:3)
    at /home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/container.js:194:18
    at /home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/container.js:139:18
    at Rule.each (/home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/container.js:105:16)
    at Rule.walk (/home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/container.js:135:17)
    at /home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/container.js:152:24
    at Root.each (/home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/container.js:105:16)
    at Root.walk (/home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/container.js:135:17)
    at Root.walkDecls (/home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/container.js:192:19)
    at /home/username/shapez.io/gulp/node_modules/postcss-unprefix/lib/index.js:11:7
    at LazyResult.run (/home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/lazy-result.js:288:14)
    at LazyResult.asyncTick (/home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/lazy-result.js:212:26)
    at /home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/lazy-result.js:254:14
    at new Promise (<anonymous>)
    at LazyResult.async (/home/username/shapez.io/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/lazy-result.js:250:23)
[15:02:30] Finished 'css.resources.prod-standalone' after 6.09 s
[15:02:30] The following tasks did not complete: build.standalone-prod, step.standalone-prod.all, css.prod-standalone, css.main.prod-standalone
[15:02:30] Did you forget to signal async completion?
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
9p4 commented 3 years ago

Alright, so this was fixed in the worst way possible. Here are the steps I had to take to patch the code to work:

  1. Clone the repository with git clone --recursive https://github.com/tobspr/shapez.io shapez.io.git
  2. Open the directory with cd shapez.io.git
  3. Checkout the version you want to build with git checkout -b 1.2.2 (replace 1.2.2 with the version you want to build)
  4. Run yarn in the root directory
  5. Open the "electron" directory and run yarn: cd electron; yarn; cd ..
  6. Open the "gulp" folder and run yarn there too: cd gulp; yarn
  7. Edit the file "node_modules/postcss-unprefix/lib/clearDecl.js" and replace line 13 with const prop = decl.prop.replace(/^-\w+-/, "");
  8. Build standalone programs with gulp main.standalone

Outputs would be in the subdirectory tmp_standalone_files under the root directory.