1

Following the instructions at http://davidwalsh.name/upgrade-nodejs, to upgrade Node.js on a RedHat Fedora 16 server, I get the error...

cp: cannot overwrite directory `/usr/local/bin/node' with non-directory

... and the version of node remains unchanged.

node --version
v0.10.12

# sudo npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.
# sudo npm install -g n
npm http GET https://registry.npmjs.org/n
npm http 200 https://registry.npmjs.org/n
npm http GET https://registry.npmjs.org/n/-/n-2.0.2.tgz
npm http 200 https://registry.npmjs.org/n/-/n-2.0.2.tgz
/usr/bin/n -> /usr/lib/node_modules/n/bin/n
npm WARN package.json fresh@0.1.0 No repository field.
npm WARN package.json methods@0.0.1 No repository field.
npm WARN package.json range-parser@0.0.4 No repository field.
npm WARN package.json send@0.1.0 No repository field.
npm WARN package.json cookie-signature@1.0.1 No repository field.
npm WARN package.json bytes@0.2.0 No repository field.
npm WARN package.json pause@0.0.1 No repository field.
npm WARN package.json eyes@0.1.8 No repository field.
npm WARN package.json eventemitter2@0.4.11 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
n@2.0.2 /usr/lib/node_modules/n
# sudo n stable

     install : node-v0.12.7
       mkdir : /usr/local/n/versions/node/0.12.7
       fetch : https://nodejs.org/dist/v0.12.7/node-v0.12.7-linux-x64.tar.gz
cp: cannot overwrite directory `/usr/local/bin/node' with non-directory
   installed : v0.10.12

This is just on a test server, so there is no danger of disrupting the existing node service. What would be a simple way to get node to upgrade to 0.12.7?


EDIT: My solution was to rename /usr/local/bin/node then run taaem's node-install.sh script. When Node.js 0.12.7 was successfully installed, I could delete the original (renamed) directory.

James Newton
  • 6,623
  • 8
  • 49
  • 113

1 Answers1

1

Run the following commands which will upgrade the node version.

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

The n package represents a Node helper, and running the last command upgrades node to the latest stable version.

Once your install is complete, you can confirm you version with another command

sudo n 0.8.21
kds
  • 28,155
  • 9
  • 38
  • 55