kotlin-js

Exception when building a kotlin/js project: error package.json: Name contains illegal characters


Trying to build the a kotlin/js project and getting the following exception:

error package.json: Name contains illegal characters

The project is here:

https://github.com/darran-kelinske-fivestars/cordova-alternative-pattern/tree/kotlin_multiplatform/js

Full output:

3:05:37 PM: Executing task 'build'...

Executing tasks: [build] in project /rom/source/fivestars/CordovaAlternativePattern/js


> Configure project :SharedCode
Kotlin Multiplatform Projects are an experimental feature.

> Task :SharedCode:jsPackageJson
> Task :js:packageJson
> Task :js:testPackageJson
> Task :kotlinNodeJsSetup SKIPPED

> Task :kotlinNpmInstall FAILED
error package.json: Name contains illegal characters

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kotlinNpmInstall'.
>                 Process 'Resolving NPM dependencies using yarn' returns 1

                  yarn install v1.21.1
  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 885ms
4 actionable tasks: 4 executed
3:05:38 PM: Task execution finished 'build'.

Solution

  • The issue was with my rootProject.name definition in settings.gradle

    I had to change

    rootProject.name='Cordova Alternative Pattern'

    to

    rootProject.name='CordovaAlternativePattern'