Heroku won't load within Visual Studio Code
Asked Answered
G

1

3
heroku : File C:\Users\mar\AppData\Roaming\npm\heroku.ps1 cannot be loaded. The file C:\Users\mar\AppData\Roaming\npm\heroku.ps1 is not digitally 
signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see 
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

This is the error I'm getting. I've tried running "heroku -v" within the cmd and it works there so I know it was installed correctly. However, when I run the same command in visual studio I get the above error. I'm running visual studio code in admin mode and I installed heroku from admin mode as well.

I also enabled developer mode in my computer settings.

Gullet answered 14/7, 2020 at 17:4 Comment(0)
L
8

You need to set the execution policy regardless of whether you are running in administrator mode or not for PowerShell.

You can read more about this here

You can also see that it's throwing an error with regards to execution policy. The error basically means that windows could not verify the identity of the user that created the script and is blocking you from running it because it may be harmful (based on the fact that it could not verify the identity of the file creator).

This is just a counter-measure to prevent malicious scripts from running automatically.

If you want to run the script I would suggest running

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

and then running the Heroku commands. The above script removes restrictions on script executions on the current logged in user.

Lina answered 14/7, 2020 at 17:25 Comment(1)
Thank you so much :D It works, I've been stuck on this for a week!Gullet

© 2022 - 2024 — McMap. All rights reserved.