Why don’t Sass and Less work on Powershell?

Asked

Viewed 237 times

-1

I installed Sass and Less through Node.js (globally, as exemplified on the websites of the tools in question). I used both in cmd without problems, but when trying in Powershell, I received the following message:

**Sass(lessc) File C: Users u Appdata Roaming npm Sass(lessc). ps1 cannot be Loaded.

The file C: Users u Appdata Roaming npm Sass(lessc). 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.

At line:1 character:1

  • lessc

  • 
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess**
    

What is the reason for this? There is a way to solve?

NOTE: Node.js v14.2.0 installed by Chocolatey.

1 answer

1

This issue is related to Powershell security policies.

By default the execution policy is not defined(Undefined). When policy is not defined, powershell assumes restricted policy(Restricted).

You can check the documentation here.

To get around this problem, just change the execution policy by running the script below:

Set-ExecutionPolicy Bypass -Scope CurrentUser

Browser other questions tagged

You are not signed in. Login or sign up in order to post.