As soon as I open Visual Studio Code, the following appears in VSCode's own console:
. : No se puede cargar el archivo C:\Users\admin\Documents\WindowsPowerShell\profile.ps1
porque la ejecución de scripts está deshabilitada en este sistema. Para obtener más
información, consulta el tema about_Execution_Policies en
https:/go.microsoft.com/fwlink/?LinkID=135170.
En línea: 1 Carácter: 3
+ . 'C:\Users\admin\Documents\WindowsPowerShell\profile.ps1'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Cargar los perfiles personales y de sistema tardó 643ms.
I don't know if it has to do with it or not, but a few hours before I had installed node, npm and typescript (although I really updated them, since I had them from before).
The subject and my urgency in this problem is that I am doing a JavaScript course where TypeScript is used in a section. So, that was the reason why I got to update those "tools".
In addition, given a moment of the course I have to execute the following script:
tsc clase148.ts
I get the following error:
tsc : No se puede cargar el archivo C:\Users\admin\AppData\Roaming\npm\tsc.ps1 porque la
ejecución de scripts está deshabilitada en este sistema. Para obtener más información,
consulta el tema about_Execution_Policies en
https:/go.microsoft.com/fwlink/?LinkID=135170.
En línea: 1 Carácter: 1
+ tsc clase148.ts
+ ~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Enter the link:
But honestly, I don't know what to do.
It should be clarified that executing the previous script, from tsc, in a Windows 10 command line, it executes it well and without problems.
How do I fix this error, problem?
I already solved it, you must run the powershell as administrator and execute the command Set-ExecutionPolicy Unrestricted
just open the power shell and execute the following command Set-ExecutionPolicy Unrestricted this will solve your problem and you will be able to execute scripts in the VS Code console
With that you should be able to run scripts in powershell. Greetings.