Search code examples
node.jsmacosnpmsublimetext3browser-sync

Browser Sync Not Working Permissions Issue


Browser Sync is not launching live server after installing node/npm as a root user. Backstory: I tried installing Browser Sync npm to no avail then i installed the npm package and got a permissions error so i installed via the root and it installed. I switched to my regular user acct and tried to launch browser sync to no avail i assumed it would run b/c npm or node was a globe install. While in my regular user account, i ran npm install -g browser-sync in the terminal again, however im still having permissions issues.

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

I'm using sublime 3 on a mac. Also, i tried using browser sync w/o installing npm to no avail any suggestions would be appreciated, even another tool recommendation.


Solution

  • Change the golbal insall directory using npm config command.

    mkdir ~/.npm-global
    npm config set prefix '~/.npm-global'
    export PATH=~/.npm-global/bin:$PATH
    

    More info: http://npm.github.io/installation-setup-docs/installing/a-note-on-permissions.html