3

I have the following setup. Kotlin Multiplatform project with a Web App and Shared module. I also have included a build of a library that I had to modify myself as it wasn't working properly.

When trying to deploy to Heroku with these steps I get the following error

    > Task :common:root:jsPackageJson
       > Task :web-app:packageJson
       > Task :web-app:testPackageJson
       > Task :rootPackageJson
       
       > Task :kotlinNpmInstall
       warning workspace-aggregator-7524aa80-df12-48c3-95c5-de7144004dc0 > firebase-kotlin-sdk-firebase-app > webpack-dev-server > sockjs > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
       warning workspace-aggregator-7524aa80-df12-48c3-95c5-de7144004dc0 > firebase-kotlin-sdk-firebase-app > webpack-dev-server > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
       error https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/app/.cache/yarn/v6/npm-caniuse-lite-1.0.30001269-3a71bee03df627364418f9fd31adfc7aa1cc2d56-integrity/node_modules/caniuse-lite/LICENSE'"
       
       > Task :firebase-kotlin-sdk:kotlinNpmInstall
       error https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/app/.cache/yarn/v6/npm-caniuse-lite-1.0.30001269-3a71bee03df627364418f9fd31adfc7aa1cc2d56-integrity/node_modules/caniuse-lite/data/features/getcomputedstyle.js'"
       
       > Task :firebase-kotlin-sdk:kotlinNpmInstall FAILED
       > Task :kotlinNpmInstall FAILED
       
       FAILURE: Build completed with 2 failures.
       
       1: Task failed with an exception.
       -----------
       * What went wrong:
       Execution failed for task ':kotlinNpmInstall'.
       >                 Process 'Resolving NPM dependencies using yarn' returns 1
                         
                         yarn install v1.22.10
         info No lockfile found.
         [1/4] Resolving packages...
         [2/4] Fetching packages...
         info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
       
       
       * Try:
       Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
       ==============================================================================
       
       2: Task failed with an exception.
       -----------
       * What went wrong:
       Execution failed for task ':firebase-kotlin-sdk:kotlinNpmInstall'.
       >                 Process 'Resolving NPM dependencies using yarn' returns 1
                         
                         yarn install v1.22.10
         info No lockfile found.
         [1/4] Resolving packages...
         [2/4] Fetching packages...
         info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
       
       
       * Try:
       Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
       ==============================================================================
       
       * Get more help at https://help.gradle.org
       
       BUILD FAILED in 5m 20s
       18 actionable tasks: 18 executed
 !     ERROR: Failed to run Gradle!
       We're sorry this build is failing. If you can't find the issue in application
       code, please submit a ticket so we can help: https://help.heroku.com
       You can also try reverting to the previous version of the buildpack by running:
       $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-gradle#previous-version
       
       Thanks,
       Heroku
 !     Push rejected, failed to compile Gradle app.
 !     Push failed

Tried running kotlinNpmInstall locally on both the library and the whole project and it works properly, with no failures.

Nikola-Milovic
  • 1,393
  • 1
  • 12
  • 35

1 Answers1

0

While I do not know the exact cause, it seems that multiple yarn process are spawned that corrupt each other's packages.

This can be solved with the mutex option. To add yarn options to a kotlin/js project you can add a .yarnrc file to the root of your project.

My .yarnrc's content:

--install.mutex network

This makes yarn use a predefined port on the network for its mutex.

Minmo
  • 143
  • 3
  • 6