0

I want to import a local npm package into my kotlin project but I get the error Can't add "convert": invalid package version "".

File structure:

project
  - js
    - package.json
    - convert.js
  - src
  - build.gradle.kts

My build.gradle.kts:

plugins {
    kotlin("js")
}

dependencies {
    implementation(npm("convert", "file:../../../../wikimarkup-converter/js"))
}

configureKotlinJs()
configurePublication()

My path is correct, because it gives me another error when it's any different.

My package.json

{
  "name": "convert",
  "main": "convert.js",
  "dependencies": {
    ...
  }
}

When I set a version "1.0" in my package.json I get the error

Can't add "convert": invalid package version "1.0".

in Gradle. So whatever version is in there is invalid.

I know there is a similar question, but it has no answers, and the issue is completely different.

aSemy
  • 5,485
  • 2
  • 25
  • 51
1cedsoda
  • 623
  • 4
  • 16
  • Does this answer your question? [Is it possible to import a JavaScript file in a Kotlin/JS project?](https://stackoverflow.com/questions/67661122/is-it-possible-to-import-a-javascript-file-in-a-kotlin-js-project) – aSemy Jul 22 '22 at 15:56
  • See also https://stackoverflow.com/a/68177037/4161471 https://stackoverflow.com/q/66546059/4161471 – aSemy Jul 22 '22 at 15:56

0 Answers0