question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

zsh on macOS leads to 'zsh:1: command not found: PACKAGE_SOURCE_NUGET_ORG'

See original GitHub issue

Hey,

when trying to execute maui-check on macOS (intel) within a zsh, the installation raises the following issue:

⏳ Attempting to fix: .NET SDK - Workloads (6.0.301)
SHELL: /bin/zsh /var/folders/jr/jj_6h9hd76q6kp3szcd3zjjw0000gn/T/tmpzUAKsP.tmp
zsh:1: command not found: PACKAGE_SOURCE_NUGET_ORG
Password:

which is due to the issue that within the *manifest.json files $() (command substitution) is used instead of ${} (parameter substitution) which works in bash but not within zsh, see:

MYDIR=.
ls $(MYDIR)

does not work in zsh, but

MYDIR=.
ls ${MYDIR}

works fine in both.

This is the root cause, however, to show the actual error, here the stack trace when continuing:

Unhandled exception: System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   at Microsoft.DotNet.Cli.NuGetPackageDownloader.PackageSourceLocation.ExpandLocalFeed(String[] sourceFeedOverrides)
   at Microsoft.DotNet.Workloads.Workload.Install.WorkloadInstallCommand..ctor(ParseResult parseResult, IReporter reporter, IWorkloadResolver workloadResolver, IInstaller workloadInstaller, INuGetPackageDownloader nugetPackageDownloader, IWorkloadManifestUpdater workloadManifestUpdater, String dotnetDir, String userProfileDir, String tempDirPath, String version, IReadOnlyCollection`1 workloadIds)
   at Microsoft.DotNet.Cli.WorkloadInstallCommandParser.<>c.<ConstructCommand>b__14_0(ParseResult parseResult)
   at Microsoft.DotNet.Cli.ParseResultCommandHandler.Invoke(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
Fix failed - Workload Install failed: `dotnet workload install --from-rollback-file 
"/var/folders/jr/jj_6h9hd76q6kp3szcd3zjjw0000gn/T/maui-check-cbd22571/workload.json" android ios maccatalyst tvos macos maui --source
"$(PACKAGE_SOURCE_NUGET_ORG)"`
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


🔔 There were one or more problems detected.
Please review the errors and correct them and run maui-check again.

I tried to fix the issue by replacing the parentheses locally with curly braces and hard-coding the file path instead of the given manifest url to enforce the program to read in the new values. However, I run into all sorts of problems, the latest occurring at BootsSolution.cs:32 which fails with

⏳ Attempting to fix: .NET SDK
  Installing .NET SDK 6.0.400-rtm.22371.2...
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
  at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()                                     
  at Boots.Core.HttpClientWithPolicy.DoDownloadAsync(Uri uri, String tempFile, CancellationToken token)
  at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()                   
  ⚠ Installation failed for .NET SDK 6.0.400-rtm.22371.2.
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
  at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()                                     
  at Boots.Core.HttpClientWithPolicy.DoDownloadAsync(Uri uri, String tempFile, CancellationToken token)
  at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()                   
Fix failed - Response status code does not indicate success: 404 (Not Found).

❌ Skipped: .NET SDK - Workload Deduplication

❌ Skipped: .NET SDK - Workloads (6.0.400-rtm.22371.2)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Checkup had Error status: xcode
Checkup had Error status: dotnet

xcode: Found invalid data while decoding.
dotnet: .NET SDK (6.0.400-rtm.22371.2) not installed.
🔔 There were one or more problems detected.
Please review the errors and correct them and run maui-check again.

I already spent some time with the code base and would rather ask for some help before spending more time on a thing I assume should be presumably easy to fix. I am willing to create a PR, but would like to have some feedback on the planned changes and the error shown above.

Regards, flennic

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:10
  • Comments:12

github_iconTop GitHub Comments

2reactions
bbenetskyycommented, Sep 24, 2022

@flennic I try to run failed command with the PACKAGE_SOURCE_NUGET_ORG value found in this repo:

sudo dotnet workload install android ios maccatalyst tvos macos maui --source "https://api.nuget.org/v3/index.json"

This install for me all that - which was failed

1reaction
renatosccommented, Mar 6, 2023

Ok, I found the issue.

The code was supposed to replace the placeholder $(PACKAGE_SOURCE_NUGET_ORG) in the manifest with the value of the variable “PACKAGE_SOURCE_NUGET_ORG” that is also defined in the manifest. The are 2 instances of that placeholder in the manifest (under “variableMappers” and “dotnet”->“sdks”), the first replace was ocurring fine but the second was failing due to the type associated to it. The DotNetSdk.cs file is defining PackageSources of type List<string> but that type fails in the check that happens on Check.cs:70/71 if (!prop.CanWrite) continue;

The fix was to have PackageSources defined of type string[] (as it is in the class NuGetFeedVariableMapper.cs where the replace occurs fine).

Here is the PR that fixes that: https://github.com/Redth/dotnet-maui-check/pull/164

Read more comments on GitHub >

github_iconTop Results From Across the Web

in mac always getting zsh: command not found: [closed]
On MacOS BigSur Click Terminal >> Preferences change the from /bin/zsh to /bin/bash Close and reopen the terminal.
Read more >
How to Fix Zsh Command Not Found Error on macOS [5 ...
Solution 1. Check the Syntax When Zsh Command Not found · Solution 2. Ensure the Package of the Zsh Command Is Installed ·...
Read more >
[Fixed] Mac Command Not Found Error in Terminal
When Terminal says "command not found", it means that the command you entered isn't in your search path. This can occur due to...
Read more >
Issues · Redth/dotnet-maui-check
maui-check complains that dotnet version 6.0.0 are not installed ... zsh on macOS leads to 'zsh:1: command not found: PACKAGE_SOURCE_NUGET_ORG'.
Read more >
"zsh:1: command not found: git" Emacs App on MacOS
It also complains about not finding tr . I suspect that you've changed your PATH environment variable to something invalid such that it ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found