8

When I install chocolatey, I get error like this :

enter image description here

...

WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
...

WARNING: You can safely ignore errors related to missing log files when
  upgrading from a version of Chocolatey less than 0.9.9.
  'Batch file could not be found' is also safe to ignore.
  'The system cannot find the file specified' - also safe.
WARNING: Not setting tab completion: Profile file does not exist at
'C:\Users\Chelsea
\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.

...

How can I solve the error?

4
  • Adding the error text as text (if possible) would be helpful to have in addition to the image
    – bertieb
    Commented Apr 13, 2018 at 12:33
  • @dsstorefile Yes. I mean warning Commented Apr 13, 2018 at 12:57
  • @bertieb I update my question Commented Apr 13, 2018 at 13:00
  • You have three warnings, only one, is important. So which warning are you worried about. Have you closed and reopened your PowerShell prompt?
    – Ramhound
    Commented Apr 14, 2018 at 1:56

2 Answers 2

9

Here's the solution for the tab completion warning:

  1. Open a PowerShell session and run: notepad $profile This opens the profile file in Notepad.

  2. Copy and paste the following code into Notepad and save the file:

# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
  Import-Module "$ChocolateyProfile"
}
  1. Restart PowerShell

Source: https://docs.chocolatey.org/en-us/troubleshooting#why-does-choco-tab-not-work-for-me

4
  • I think you mean chocolateyProfile.ps1
    – mbomb007
    Commented Feb 23, 2021 at 15:28
  • On what chocolatey version are you seeing chocolateyProfile.ps1? On 0.10.15 it’s .psm1. Commented Feb 25, 2021 at 15:12
  • Never mind. I wasn't familiar with PowerShell modules
    – mbomb007
    Commented Feb 25, 2021 at 19:54
  • 1
    After doing the above points (thanks!), I then got "execution of scripts is disabled on this system." Fixed by following steps in stackoverflow.com/questions/4037939/…: Set-ExecutionPolicy -ExecutionPolicy Unrestricted Commented Mar 21, 2022 at 9:05
3

Just ran into this warning myself. It occurs because there is not an existing PowerShell profile for your Windows user.

To create a profile, open a PowerShell session and enter:

if (!(Test-Path -Path $PROFILE)) {
  New-Item -ItemType File -Path $PROFILE -Force
}

I pulled the above code from Microsoft's documentation. The page covers a lot more about profiles if you are interested.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .