Thursday, November 5, 2015

Brew Node Installation Error


brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-5.0.0.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring node-5.0.0.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists. You may want to remove it:
  rm '/usr/local/share/doc/node/gdbinit'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

To list all files that would be deleted:
  brew link --overwrite --dry-run node

Possible conflicting files are:
/usr/local/share/doc/node/gdbinit
/usr/local/share/systemtap/tapset/node.stp
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/node/5.0.0: 2824 files, 36M
=================================================================

Error: Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.
akshays-MacBook-Pro:bin akshay$ sudo brew link --overwrite node
Error: Cowardly refusing to `sudo brew link`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
=================================================================

SOLUTION:

sudo chown -R $USER /usr/local
brew doctor
brew link --overwrite node
After that Check 
which node

Error while deleting multiple files : Argument list too long

Today when i tried to delete multiple files from linux machine using following commands


sudo rm -rf filename*

I got the error

sudo: unable to execute /bin/rm: Argument list too long




instead of rm -rf command use following command 


sudo find . -name "filename*" -exec rm -v {} \;


How to upgrade the NodeJS

Today I was trying to build a website in express. And I noticed that on my Macbook, My node version is one year old.

To check node in the machine

node --version

You might see something like
v0.10.28

Check the latest version of NodeJS to check, whether you need to upgrade the node or not.

https://nodejs.org/en/download/releases/


To upgrade Node through npm

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

Check Node version again

node -v

it should be as per the node stable version. In my case "v5.0.0

Check the global npm list
npm -g list 


You might see some errors as following when you check the global list

npm ERR! extraneous: asap@2.0.3 /usr/local/lib/node_modules/npm/node_modules/asap
npm ERR! invalid: fstream-ignore@0.0.7 /usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore
npm ERR! missing: minimatch@~0.2.0, required by fstream-ignore@0.0.7



To update outdated package, use following command
sudo npm outdated -g --depth=0