'browser-sync on Windows 11

I’m starting browser-sync by running browser-sync start -c .\bs-config.js in PowerShell. On Windows10 it works fine but Win11 has some new security features that prevent it from functioning.

First of all we need to open PowerShell in admin and run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned which enables system to open any NPM programs. Unfortunately browser-sync still needs more perms.

Next step was opening the C:\Users\[username]\AppData\Roaming\npm\browser-sync.ps1 (for global installation of browser-sync) and adding a line on top of the file: Set-ExecutionPolicy -Scope CurrentUser unrestricted.

enter image description here

That seems to supress all warning messages in PowerShell however the proxy won’t start...

enter image description here

NOTE: this command works fine tho: browser-sync http://localhost/



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source