Abp: CLI Broken, abp new doesn't work

Created on 30 Oct 2019  路  12Comments  路  Source: abpframework/abp

I have tried to use CLI to create a new template but doesn't work.

abp new Acme.BookStore
[17:15:26 INF] ABP CLI (https://abp.io)
[17:15:27 INF] Version 1.0.2 (Stable channel)
[17:15:28 INF] Creating your project...
[17:15:28 INF] Project name: Acme.BookStore
[17:15:28 INF] Output folder: C:\Users\XXX\Development\Abp\1.0.2\Acme.BookStore
[17:15:29 ERR] Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadAndMoveToContent()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Volo.Abp.Json.Newtonsoft.NewtonsoftJsonSerializer.Deserialize[T](String jsonString, Boolean camelCase) in D:\Github\abp\framework\src\Volo.Abp.Json\Volo\Abp\Json\Newtonsoft\NewtonsoftJsonSerializer.cs:line 27
   at Volo.Abp.Cli.ProjectBuilding.AbpIoSourceCodeStore.GetLatestSourceCodeVersionAsync(String name, String type) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuilding\AbpIoSourceCodeStore.cs:line 107
   at Volo.Abp.Cli.ProjectBuilding.AbpIoSourceCodeStore.GetAsync(String name, String type, String version) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuilding\AbpIoSourceCodeStore.cs:line 52
   at Volo.Abp.Cli.ProjectBuilding.TemplateProjectBuilder.BuildAsync(ProjectBuildArgs args) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuilding\TemplateProjectBuilder.cs:line 50
   at Volo.Abp.Cli.Commands.NewCommand.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\NewCommand.cs:line 92
   at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 55

The error is raised from GetLatestSolurceCodeVersionAsync method of AbpIoSourceCodeStore:

        private async Task<string> GetLatestSourceCodeVersionAsync(string name, string type)
        {
            using (var client = new CliHttpClient())
            {
                var response = await client.PostAsync(
                    $"{CliUrls.WwwAbpIo}api/download/{type}/get-version/",
                    new StringContent(
                        JsonSerializer.Serialize(
                            new GetLatestSourceCodeVersionDto { Name = name }
                        ),
                        Encoding.UTF8,
                        MimeTypes.Application.Json
                    ),
                    CancellationTokenProvider.Token
                );

                await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response);

                var result = await response.Content.ReadAsStringAsync();

                return JsonSerializer.Deserialize<GetLatestSourceCodeVersionResultDto>(result).Version;
            }
        }

I have tried to make a Postman to this url:

https://abp.io/api/download/template/get-version

Using post verb and this body:

{
    Name: "Acme.BookStore"
}

And I get html response and not json as expected ...

abp-cli problem

Most helpful comment

Fixed.

All 12 comments

In addition direct download option at http://abp.io/get-started neither works...

I guess the version number you passed is like 0.19, but the correct format should be one digit more: 0.19.0
The error message should indeed be more specific.

We will fix it as soon as possible. Thanks for the feedback.

Fixed.

This issue appears to still exist, albeit getting a slightly different error message now:

abp new Acme.BookStore

``` [16:36:48 INF] ABP CLI (https://abp.io) [16:36:48 INF] Version 1.0.2 (Stable channel) [16:36:48 WRN] Unable to retrieve the latest version [16:36:48 WRN] Object reference not set to an instance of an object. [16:36:48 INF] Creating your project... [16:36:48 INF] Project name: Acme.BookStore [16:36:48 INF] Output folder: C:\Dev\FromAbel\abp [16:36:48 ERR] Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at System.Net.Http.WinHttpHandler.SetRequestHandleProxyOptions(WinHttpRequestState state) at System.Net.Http.WinHttpHandler.SetRequestHandleOptions(WinHttpRequestState state) at System.Net.Http.WinHttpHandler.StartRequestAsync(WinHttpRequestState state) at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Volo.Abp.Cli.ProjectBuilding.AbpIoSourceCodeStore.GetLatestSourceCodeVersionAsync(String name, String type) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuildingAbpIoSourceCodeStore.cs:line 91
at Volo.Abp.Cli.ProjectBuilding.AbpIoSourceCodeStore.GetAsync(String name, String type, String version) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuildingAbpIoSourceCodeStore.cs:line 52
at Volo.Abp.Cli.ProjectBuilding.TemplateProjectBuilder.BuildAsync(ProjectBuildArgs args) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuilding\TemplateProjectBuilder.cs:line 50
at Volo.Abp.Cli.Commands.NewCommand.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\NewCommand.cs:line 92
at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 55

````

Is there anything we as community contributors can do to prevent this issue from occuring? Considering that the issue is related to an API call being made to the abp.io website, I'm wondering if we could modify the command to pull the latest release from GitHub instead of depending on the website. I'm sure that the re-occurence of this kind of issue is an annoyance and pulls development time away from the project itself.

I will explore this route in the meantime but I wanted to bring this issue to your attention. Please let me know if you need any additional information to diagnose and resolve the issue. Thanks!

After v1.1 release, we will look this issue deeper to see if we can minimize external dependencies or find a fallback logic. Thanks.

BTW, you can always use "direct download" on https://abp.io/get-started when you have problems with the CLI.

Direct download and cli new doesn't work right now. Both down.

@mehmetuken it should be working now.

@ismcagdas yes both working. Thanks.

Gonna use direct download, CLI still not seeming to work...

D:\Ivan\Dev\site.www.com>abp new site.www.com -u angular
[16:42:33 INF] ABP CLI (https://abp.io)
[16:42:33 INF] Version 1.0.2-dev (Development channel)
[16:42:33 INF] Creating your project...
[16:42:33 INF] Project name: site.www.com
[16:42:33 INF] UI Framework: Angular
[16:42:33 INF] Output folder: D:\Ivan\Dev\site.www.com
[16:42:35 INF] Downloading template: app, version: 1.0.2
[16:43:37 ERR] Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

CLI is broken after upgrade to version 1.1.1

D:_TEMP>abp new Acme.BookStore -u angular
[10:50:42 INF] ABP CLI (https://abp.io)
[10:50:43 INF] Version 1.1.1 (Stable channel)
[10:50:43 WRN] Unable to retrieve the latest version
[10:50:43 WRN] Object reference not set to an instance of an object.
[10:50:43 INF] Creating your project...
[10:50:43 INF] Project name: Acme.BookStore
[10:50:43 INF] UI Framework: Angular
[10:50:43 INF] Output folder: D:_TEMP\Acme.BookStore
[10:50:43 ERR] Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Net.Http.WinHttpHandler.SetRequestHandleProxyOptions(WinHttpRequestState state)
at System.Net.Http.WinHttpHandler.SetRequestHandleOptions(WinHttpRequestState state)
at System.Net.Http.WinHttpHandler.StartRequestAsync(WinHttpRequestState state)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Volo.Abp.Cli.ProjectBuilding.AbpIoSourceCodeStore.GetLatestSourceCodeVersionAsync(String name, String type) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuildingAbpIoSourceCodeStore.cs:line 91
at Volo.Abp.Cli.ProjectBuilding.AbpIoSourceCodeStore.GetAsync(String name, String type, String version) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuildingAbpIoSourceCodeStore.cs:line 52
at Volo.Abp.Cli.ProjectBuilding.TemplateProjectBuilder.BuildAsync(ProjectBuildArgs args) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuilding\TemplateProjectBuilder.cs:line 50
at Volo.Abp.Cli.Commands.NewCommand.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\NewCommand.cs:line 90
at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\Github\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 55

Was this page helpful?
0 / 5 - 0 ratings