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

Error when i run localDevEnv.ps1 #61

Closed
ingebruvik opened this issue Dec 18, 2021 · 12 comments
Closed

Error when i run localDevEnv.ps1 #61

ingebruvik opened this issue Dec 18, 2021 · 12 comments
Labels
Unrelated to AL-Go This issue is unrelated to AL-Go

Comments

@ingebruvik
Copy link

I get the error below when i run the localDevEnv.ps1 step
I tried to run the Import-Module Microsoft.PowerShell.Archive but that did noe help me.,
Any ideas about what is causing my problem?

Downloading BcContainerHelper latest version
Using Expand-Archive
Expand-7zipArchive : The 'Expand-Archive' command was found in the module 'Microsoft.PowerShell.Archive', but the module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Archive'.
At C:\Users\bruviki\AppData\Local\Temp\tmp30E3.tmp.ps1:253 char:9

  •     Expand-7zipArchive -Path "$tempName.zip" -DestinationPath $te ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Expand-Archive:String) [Expand-7zipArchive], CommandNotFoundException
    • FullyQualifiedErrorId : CouldNotAutoloadMatchingModule,Expand-7zipArchive
@freddydk
Copy link
Collaborator

Could you try to run:

Import-Module Microsoft.PowerShell.Archive

on your machine?
Which error is returned?

Thanks

@freddydk
Copy link
Collaborator

In the end, there is something wrong with the machine - or some module installed, which prevents Expand-Archive to run.
You can also download and install 7zip (from https://www.7-zip.org/download.html), then the code will bypass Expand-Archive (and be faster).

@freddydk freddydk added the Unrelated to AL-Go This issue is unrelated to AL-Go label Dec 24, 2021
@ingebruvik
Copy link
Author

I get no error when i run the Import-Module Microsoft.PowerShell.Archive command.
I will try to download and install 7zip and see what happens then.

@BW-PA
Copy link
Contributor

BW-PA commented Mar 25, 2022

I encountered the same error when running localDevEnv.ps1

Expand-7zipArchive : The 'Expand-Archive' command was found in the module 'Microsoft.PowerShell.Archive', but the module could not be 
loaded. For more information, run 'Import-Module Microsoft.PowerShell.Archive'.

When I run Import-Module Microsoft.PowerShell.Archive I get the following error

Import-LocalizedData : Cannot find the Windows PowerShell data file 'ArchiveResources.psd1' in directory 
'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\en-GB\', or in any parent culture directories.
At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:28 char:1
+ Import-LocalizedData  LocalizedData -filename ArchiveResources
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\WINDOWS\syst...eResources.psd1:String) [Import-LocalizedData], PSInvalidOperationExcep  
   tion
    + FullyQualifiedErrorId : ImportLocalizedData,Microsoft.PowerShell.Commands.ImportLocalizedData

I have 7zip installed

@BW-PA
Copy link
Contributor

BW-PA commented Mar 25, 2022

Interestingly, when I run localDevEnv.ps1 within a standalone powershell window I don't get the error and it uses 7zip
image

So it seems the error only occurs when running localDevEnv.ps1 from within VSCode integrated powershell terminal like is shown in the scenario steps screenshots

@freddydk
Copy link
Collaborator

freddydk commented Mar 25, 2022

@BW-PA thanks for the explanation - will investigate that.

@gunnargestsson
Copy link

Same here, works in Powershell but not in the terminal section of VS Code.

@BusinessCentralGeek
Copy link

BusinessCentralGeek commented Apr 12, 2022

Hi, I can´t get pass 'Removing BcContainerHelper' step. Tried from VSCode terminal and from PowerShell with no luck. The image is pulled but the problem is building the container. Tried running 'uninstall-module bccontainerhelper' before the scipt but with no luck.

image

@freddydk
Copy link
Collaborator

That seems to be a local problem - a restart of the host will probably solve this.

@BusinessCentralGeek
Copy link

Thanks for the quick reply. I´ve already restarted the machine several times, also reinstalled docker. When the error occurs docker wouldn´t start and need to uninstall it again every time it fails to create the container.
With this type of scripts I have no problem and the container works fine:

image

I believe "driver "windowsfilter" failed to remove root
filesystem: failed to detach VHD: failed to detach virtual disk: The device is not ready.: rename"
is the problem but have no clue on how to solve it.
Some more info if it helps:

image

@BusinessCentralGeek
Copy link

After reading this thread https://github.com/microsoft/navcontainerhelper/issues/2086

I could finally create it by turning off Windows Defender antivirus... At last..., I should have read the thread and try it sooner.

@freddydk
Copy link
Collaborator

On the original error (@ingebruvik, @BW-PA and @gunnargestsson) in this issue, v1.2 of AL-Go will spawn a new PowerShell window elevated when trying to run from VS Code - instead of using the VS Code runner.

on @BusinessCentralGeek - the localDevEnv now includes a text:

NOTE: You need to have Docker installed, configured and be able to create Business Central containers for this to work.
If this fails, you can setup a cloud based development environment by running cloudDevEnv.ps1

and I am also working on supporting ACIs (Azure Container Instances) and Azure VMs for people having problems running docker on their machine. Unfortunately, we are seeing an increasingly number of problems with defender and Windows 10 (even some Windows 11).

freddydk added a commit that referenced this issue Sep 6, 2022
'Collect changes from freddydk/*@main'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unrelated to AL-Go This issue is unrelated to AL-Go
Projects
None yet
Development

No branches or pull requests

5 participants