cannot install browser-sync on macbook - macos

I'm using the latest macbook air laptop and trying to install browser-sync globally by this command "sudo npm install -g browser-sync" after install node.js and npm succesfully.
but after I tried this command, my terminal shows this error message again and again when I'm trying to install the package repeatly since I cannot find the browser-sync command.
could anyone help me solve this problem? thank you so much in advance!
I have tried to install this package since yesterday and really don't know how it will work. I checked the user/judy/node_modules folder and can find 3 browser-sync related folders, and tried to delete them but still failed to make the command work.
error message
(base) judy#judydeAir node_modules % sudo npm install -g browser-sync
Password:
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/browser-sync
npm ERR! dest /usr/local/lib/node_modules/.browser-sync-7ZQRhsQ1
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/usr/local/lib/node_modules/browser-sync' -> '/usr/local/lib/node_modules/.browser-sync-7ZQRhsQ1'
my path:
(base) judy#judydeAir node_modules % echo $PATH
/Users/judy/opt/anaconda3/bin:/Users/judy/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
failed to use browser-sync command:
(base) judy#judydeAir node_modules % browser-sync --version
zsh: command not found: browser-sync

Related

EPERM error when running npm install global using Git Bash?

If I use Command Prompt and run it as admin, I get no problems.
But when I use Git Bash, for whatever reason, when I try to install anything globally, I get this error:
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\.staging
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging'...
When I'm installing packages locally in specific project folders, a plain npm install, it works perfectly. But I've been trying to run npm install -g bower successfully to no avail.
Sure, I can just run cmd as admin, but I was hoping to get to the bottom of this and understand the problem.
I've tried reinstalling Git Bash, reinstalled Node.js, but still didn't make any progress.

NPM install fails with ETXTBSY error, text file is busy

Trying to use laravel-mix, but when i try npm install, or npm install --no-bin-links, or sudo npm install, i get this error below.. I'm on windows 8.1 using homestead and vagrant.. Please any help on this
npm WARN ETXTBSY: text file is busy, unlink '/home/vagrant/blog/mix/node_modules/abbrev/package.json.78971974'
npm ERR! path /home/vagrant/blog/mix/node_modules/acorn-dynamic-import/package.json.247239
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rename
npm ERR! ETXTBSY: text file is busy, rename '/home/vagrant/blog/mix/node_modules/acorn-dynamic-import/package.json.247239' -> '/home/vagrant/blog/mix/node_modules/acorn-dynamic-import/package.json'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2017-09-04T00_51_52_140Z-debug.log
I had the same issue and couldn't get npm to work.
Try using yarn.
homestead ssh
sudo npm install -g yarn
cd blog/mix
yarn install

Unable to install Ionic with npm? (Mac OSX El Capitan 10.11.2)

I am trying to install Ionic using npm, on my mac, running OSX El Capitan 10.11.2.
sudo npm install -g cordova ionic
Cordova is already installed, and I definitely entered my password correctly. Here are the error messages and logs:
Last login: Sun May 1 18:41:17 on ttys001
egaumbp:~ gg$ sudo npm install -g cordova ionic
Password:
/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova
/usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic
> node-sass#3.4.2 install /usr/local/lib/node_modules/ionic/node_modules/node-sass
> node scripts/install.js
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
path.js:424
var path = (i >= 0) ? arguments[i] : process.cwd();
^
Error: EACCES: permission denied, uv_cwd
at Error (native)
at Object.posix.resolve (path.js:424:50)
at startup (node.js:96:32)
at node.js:968:3
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
npm ERR! node v4.4.1
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
npm ERR! node-sass#3.4.2 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#3.4.2 install script 'node scripts/install.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/gg/npm-debug.log
egaumbp:~ gg$
Is there a solution?
If you are having issues install Ionic, you might wanna check an article I wrote on installing it: https://medium.com/#gautham.gg/how-to-install-ionic-on-mac-without-issues-3efe92a0da93#.yh5zsay13
Here is a summary of the article:
Prerequisite: npm must be installed. You can check this by entering this command: 'npm -v'. This should give you the version number. If not please install them.
Now lets fix the issue.
First launch this command:
sudo npm install --global --unsafe-perm quickscrape
Then, launch this command:
sudo npm install -g cordova ionic --unsafe-perm quickscrape
Now, run this command:
sudo npm install -g ionic --unsafe-perm node-sass
Once I did this, Ionic worked beautifully. This was done on a MacBook Pro (Retina, 13-inch, Late 2012), running OSX El Capitan 10.11.2.
I'm not sure if Windows users have any issues with this, but I believe that you should remove the 'sudo' if you are doing this on windows.
Now that you have followed my steps, both Ionic and Cordova should be installed, and working. Start by creating a blank Ionic project:
ionic start myApp blank
no idea what 'quickscrape' (in the accepted answer) is, but the solution as given here was easier and worked for me:
sudo chown -R $USER /usr/local/
and then never use sudo again with npm.

NPM install fails

I am currently unable to install NPM on Mac OS, I have looked all over the place for someone with the same error, but I can't seem to find any. Could anyone give me a hand? This is what I get after running the curl command to install NPM:
All clean!
npm-install-94139.sh: line 302: 94407 Segmentation fault: 11 "$node" cli.js rm npm -gf
npm ERR! addLocal Could not install .
npm ERR! Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock'
npm ERR! { [Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.5.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package
npm ERR! node -v v0.8.19
npm ERR! npm -v 1.1.71
npm ERR! path /Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package/npm-debug.log
npm ERR! not ok code 0
It failed
The solution on this other question seems better than messing around with NVM - npm throws error without sudo
SOLUTION:
You need to unlock permissions in home directory, like Noah says.
sudo chown -R `whoami` ~/.npm
You also need to write it to your library as well, like Xilo says.
sudo chown -R `whoami` /usr/local/lib/node_modules
My guess is that a directory used by npm (maybe /usr/local or something in your home folder) has the wrong permissions. Installing with sudo might work now but it can also bite you later since you'll definitely create files and directories as root, possibly causing problems later when npm tries to cache things.
My advice would be to uninstall, then reinstall via nvm instead. This does a great job of managing different node versions under ~/.nvm without having to use sudo.
Try clearing npm cache with
npm cache clean
Hope that helps.
when all else fails, clear you cache
Did you try "sudo" with your curl command?
Also, if you install a new version of Node, it now includes NPM, so you don't have to even install NPM separately..
From the NPM readme file: https://npmjs.org/doc/README.html
SUPER EASY INSTALL
npm comes with node now.
Windows Computers
Get the MSI. npm is in it.
Apple Macintosh Computers
Get the pkg. npm is in it.
Other Sorts of Unices
Run make install. npm will be installed with
node.
If you want a more fancy pants install (a different version, customized paths, etc.) then read on...

error installing coffeescript on mac 10.7.2

Node and npm are both installed and up to date but keep getting this error when trying to install coffeescript. I am still new to programming so any advice would be greatly appreciated.
test-macbook:~ Test$ npm -v
1.1.0-3
test-macbook:~ Test$ node -v
v0.6.8
test-macbook:~ Test$ npm install -g coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/coffee-script
npm ERR! Could not create /usr/local/lib/node_modules/___coffee-script.npm
npm ERR! error installing coffee-script#1.2.0
npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR!
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! cwd /Users/Dylan
npm ERR! node -v v0.6.8
npm ERR! npm -v 1.1.0-3
npm ERR! path /usr/local/lib/node_modules/___coffee-script.npm
npm ERR! code EACCES
npm ERR! message EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Dylan/npm-debug.log
npm not ok
Following the advice of nmp author Isaac Z. Schlueter:
I strongly encourage you not to do package management with sudo!
Instead of sudo npm install ... you could instead change permissions on your /usr/local directory:
sudo chown -R $USER /usr/local
After doing this once, you should be able to npm install ... (without sudo).
I realize this is an older thread, but I just ran across this and wanted to update the last answer.
Changing the owner of the entire /usr/local directory is a horrible answer to this question. There's no reason at all that you should do that.
If you look at the error message from npm, it's being denied write permissions on /usr/local/lib/node_modules/ I know that after installing node and npm on OS X Mavericks, its default owner is a non-existent user.
0 drwxr-xr-x 3 24561 wheel 102 Jan 23 14:17 node_modules
If you're just running node/npm on your local development machine, just change the owner of the node_modules folder to your user:
sudo chown -R yourusername /usr/local/lib/node_modules
Then you can install modules with npm without sudo and without changing the owner of /usr/lib from root, as it should be.
The error message is fairly clear:
npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
You can't install it in /usr/local/lib/node_modules because you don't have the necessary permissions. Try using sudo:
dylan-hermans-macbook:~ sudo npm install -g coffee-script
The npm author recommends not using sudo because packages can run arbitrary commands so sudo npm install is dangerous. He suggests switching the ownership of /usr/local to your user. I think that's horribly advice that just gives you a false sense of security: if a package can run arbitrary commands then it can mess with your home directory (including all your personal data, executables, config and startup files, ...) regardless of sudo or who owns /usr/local so not using sudo really doesn't do much for you. If you don't trust a package then don't install it; if you don't trust a package then how can you even use it? The /usr/local tree is still a system directory tree and OSX is still a multi-user operating system.
IMO a much better solution is twofold:
Don't install or use any packages that you don't trust. If you install it then you're trusting that code to be you (unless you're always going to run it in a jail of some sort but if you're going to those lengths you're probably better off writing the code yourself).
Leave sudo and /usr/local alone and install it all inside your home directory. You'll be subject to most of the same dangers as using sudo or changing the /usr/local ownership but at least you won't be picking up bad habits.

Resources