Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant create new project cause of ERROR: Invalid argument name: package-name #583

Open
fjr619 opened this issue Jul 23, 2024 · 2 comments
Open

Comments

@fjr619
Copy link

fjr619 commented Jul 23, 2024

Issue

Cant create new project cause of ERROR: Invalid argument name: package-name

kscript -version
Version : 4.2.3
Build : 2023-07-22T13:06:02.327407526Z
Kotlin : 1.9.24-release-822
Java : JRE 17.0.11+0

Expected

  • can create project

Steps to reproduce

  • clone project
  • setup kscript
  • run example kscript in powershell or cmd (i'am using windows) kscript new_project.kts package-name=co.mycomposeproject.example app-name="My Compose Project"
  • will cause ERROR: Invalid argument name: package-name
@luongvo
Copy link
Member

luongvo commented Jul 23, 2024

@fjr619 Could you please upload your full command log?

@fjr619
Copy link
Author

fjr619 commented Jul 23, 2024

 kscript new_project.kts package-name=co.mycomposeproject.example app-name="My Compose Project"

=> ? Running new project script version 3.29.0...


? ERROR: Invalid argument name: package-name
Run kscript new_project.kts to create a new project with the following arguments:
    package-name=   New package name (i.e., com.example.package)
    app-name=       New app name (i.e., MyApp, "My App", "my-app")
    template=       Template (i.e. compose) (optional, default: compose)
    force=          Force project creation even if the script fails (default: false)
    destination=    Set the output location where the project should be generated (i.e., /Users/johndoe/documents/projectfolder)

Examples:
    kscript new_project.kts package-name=co.mycomposeproject.example app-name="My Compose Project"
    template=compose
    kscript scripts/new_project.kts package-name=co.mycomposeproject.example app-name="My Compose
    Project" template=compose force=true
    kscript scripts/new_project.kts package-name=co.mycomposeproject.example app-name="My Compose
    Project" template=compose force=true
    destination=/Users/johndoe/documents/projectfolder

When i debug the function handleArguments, the arg always give me just package-name, instead of package-name=co.mycomposeproject.example, so it will go to else everytime i tried

and when i tried to change DELIMITER_ARGUMENT to : for example.

kscript new_project.kts package-name:co.mycomposeproject.example app-name:"My Compose Project"

it will give me other error :

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at Main_New_project$Companion.main(Main_New_project.kt:6)
        at Main_New_project.main(Main_New_project.kt)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.jetbrains.kotlin.runner.AbstractRunner.run(runners.kt:70)
        at org.jetbrains.kotlin.runner.Main.run(Main.kt:194)
        at org.jetbrains.kotlin.runner.Main.main(Main.kt:204)
Caused by: java.io.IOException: Cannot run program "sh": CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
        at java.base/java.lang.Runtime.exec(Runtime.java:594)
        at java.base/java.lang.Runtime.exec(Runtime.java:453)
        at kscript.scriplet.New_project$NewProject.executeCommand(New_project.kts:362)
        at kscript.scriplet.New_project$NewProject.cleanNewProjectFolder(New_project.kts:238)
        at kscript.scriplet.New_project$NewProject.generate(New_project.kts:103)
        at kscript.scriplet.New_project.<init>(New_project.kts:458)
        ... 14 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessImpl.create(Native Method)
        at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:499)
        at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:158)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
        ... 21 more
[kscript] [ERROR] Execution of scriplet failed:
[kscript] [ERROR] Command     : 'cmd /c  "C:[bs]Program Files[bs]Android[bs]Android Studio[bs]plugins[bs]Kotlin[bs]kotlinc[bs]bin[bs]kotlin.bat"  -classpath "C:[bs]Users[bs]Administrator[bs]AppData[bs]Local[bs]kscript[bs]jar_b64e645dbb74b1cc3afe588085c5ee1f[bs]scriplet.jar;C:[bs]Program Files[bs]Android[bs]Android Studio[bs]plugins[bs]Kotlin[bs]kotlinc[bs]lib[bs]kotlin-script-runtime.jar" Main_New_project "package-name--co.mycomposeproject.example" "app-name--My Compose Project"'
[kscript] [ERROR] Exit Code   : 1
[kscript] [ERROR]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants