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.
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
Related
I am trying to install and run npm in a linux environment. I have executed the below code to try and achieve this
nvm install v11.0.0
nvm use v11.0.0
npm install
npm start
When I execute npm install in the command line I keep getting the following error message. Any advice to help this run is much appreciated.
npm WARN saveError ENOENT: no such file or directory, open '/home/andrewoca/PycharmProjects/pythonProject/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/andrewoca/PycharmProjects/pythonProject/package.json'
npm WARN pythonProject No description
npm WARN pythonProject No repository field.
npm WARN pythonProject No README data
npm WARN pythonProject No license field.
npm install is looking for package.json in order to see what it needs to do. Since you dont have it - you get the errors.
See https://docs.npmjs.com/cli/v7/commands/npm-install
Before running npm install, create an npm project.
This can be done with npm init -y
Now you can use npm install <package name>
I was trying to install Node.js, Grunt and Harp so I downloaded Node.js and then I wrote in the terminal this (note: I also had Homebrew):
node -v
npm update -g npm
npm install -g grunt-cli
After that I installed Bootstrap files and I wrote (always from the terminal) I wrote:
npm install
the terminal returned this:
[bash-3.2# npm install
npm WARN saveError ENOENT: no such file or directory, open '/Users/Bimbi/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/Bimbi/package.json'
npm WARN Bimbi No description
npm WARN Bimbi No repository field.
npm WARN Bimbi No README data
npm WARN Bimbi No license field.
up to date in 0.05s
After that I ran these commands to update Ruby, install bundler and some dependencies:
\curl -sSL https://get.rvm.io | bash -s stable
rvm list known
rvm install ruby-2.4.2
ruby -v
rvm use ruby-2.4.2 —default
gem install bundler
bundler -v
gem init
bundle install
gem install Jekyll bundler
then I tried to install harp:
sudo npm install -g harp
the terminal returned this:
npm WARN deprecated connect#2.30.2: connect 2.x series is deprecated
npm WARN deprecated graceful-fs#3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated coffee-script#1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
/usr/local/bin/harp -> /usr/local/lib/node_modules/harp/bin/harp
+ harp#0.25.0
updated 1 package in 9.639s
after this message I ran:
harp -V
the console returned:
I have installed node.js and npm on ubuntu using aptitude but when i try to install any package like socket.io for example i get the warnings below:
username#server:~$ npm install socket.io
/home/username
└── socket.io#1.7.3
npm WARN enoent ENOENT: no such file or directory, open '/home/username/package.json'
npm WARN username No description
npm WARN username No repository field.
npm WARN username No README data
npm WARN username No license field.
Running:
Ubuntu 16.04.2 LTS
npm v4.4.4
Node.js v4.2.6
Anyone with any good ideas?
It shows just warning not error, your package got installed in node_modules.
It's best practice to create package.json always in root folder to install all required modules.
The warning also make sense, try to find package.json in /home/username/package.json
You can create package.json by command
npm init
follow the step during creation of pakcage.json
I am trying to install watchify package via npm but I am failing. After a little while the command just stops its execution. Any idea on how to fix this issue? Thx
npm install --save watchify#2.4.0
npm WARN package.json thumbnail-gulp#1.0.0 No description
npm WARN package.json thumbnail-gulp#1.0.0 No repository field.
npm WARN package.json thumbnail-gulp#1.0.0 No README data
> fsevents#0.3.8 install /Users/sandropalmieri/Documents/mycode/reactjs/thumbnail-gulp/node_modules/watchify/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild
I installed coffee-script as per directions.
$ npm install http://github.com/jashkenas/coffee-script/tarball/master
npm http GET http://github.com/jashkenas/coffee-script/tarball/master
npm http 200 http://github.com/jashkenas/coffee-script/tarball/master
npm http GET https://registry.npmjs.org/mkdirp
npm http 200 https://registry.npmjs.org/mkdirp
npm WARN package.json cookie-signature#1.0.0 No repository field.
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 ms#0.1.0 No repository field.
npm WARN package.json pause#0.0.1 No repository field.
npm WARN package.json bytes#0.2.0 No repository field.
npm WARN package.json formidable#1.0.11 No repository field.
npm WARN package.json css#1.0.8 No repository field.
npm WARN package.json uglify-js#2.2.5 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json walk#2.2.1 No repository field.
npm WARN package.json css-parse#1.0.4 No repository field.
npm WARN package.json css-stringify#1.0.5 No repository field.
coffee-script#1.6.3 node_modules/coffee-script
└── mkdirp#0.3.5
yet when i execute 'coffee' command i get
$ coffee
-bash: coffee: command not found
What am i doing wrong?
PS: i am doing this on Mac Terminal
EDIT: -
Same problem is occurs when i install nodemon the npm install takes place similar to above. But when i input a nodemon command on $ prompt it says -bash: nodemon: command not found
I installed coffeescript on my mac yeasterday as a matter of fact. Here is how I did it:
First of all, go install NodeJS.
Then go in Terminal and type the following: sudo npm install -g coffee-script
That's it - If you type in coffee in Terminal, it should start without a problem
Anything you want to run as a command (nodemon, coffee, node-inspector) must be installed with npm install -g the-package-name. If you use npm install it just puts it into your local node_modules directory and won't create the symlink for command line execution.
If you find that you need to use sudo, you might want to read this blog post: http://howtonode.org/introduction-to-npm:
what, no sudo?
I strongly encourage you not to do package management
with sudo! Packages can run arbitrary scripts, which makes sudoing a
package manager command as safe as a chainsaw haircut. Sure, it's fast
and definitely going to cut through any obstacles, but you might
actually want that obstacle to stay there.
I recommend doing this once instead:
sudo chown -R $USER /usr/local