DEV Community

with Pyaar
with Pyaar

Posted on

Browser Sync Permissions Issue

When Downloading Node.js

How frustrating. Downloading and implementing programs these days take as much time as it does to write a complex code block. When downloading Node.js to install Browser Sync, a live reload application, I ran into a permissions issue. If you’re having trouble installing Browser Sync read on.

  1. Download Node.js
    on Browser Sync’s homepage, they have a “Get Started” button on the first third of the page, which will lead you to the download page for your operating system.

  2. Install Browser Sync
    The node package manager (npm) installs Browser Sync. Render the terminal and paste the following command.

npm install -g browser-sync

So Browser sync didn’t install?

If you have an EACCESS message, you may not be able to install the package because you’re not an authorized user. How-To Geek has a step-by step-guide on how to enable the root user.

When installing as the root user, you should be succesfull, however, I was not when I switched over to my regular user account. I still had the following permissions issue when running the browser sync command.

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/browser-sync

To fix this, change the global install directory using the npm config command below.

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
That Should do it 🙂

  1. Start Browser Sync Run a command to see where you are in the terminal, like “whoami” (displays username of the current user) or “cd” (changes the directory you are in) to adjust the following to lead to a directory in which you have an “index.html” file.

browser-sync start --server --files "css/*.css"

I hope this helps! More information can be found on Github here: http://npm.github.io/installation-setup-docs/installing/a-note-on-permissions.html

Top comments (0)