Gracefully play Linux-3-ubuntu under Nodejs installation

Source: Internet
Author: User
Tags symlink

The article was originally published at the Third Frontier Institute in SZHSHP
Reprint Please specify

Ubuntu 16.04 Installation Nodejs

Oh, my God, Linux installation Nodejs is so troublesome.

Nodejs Installation
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -sudo apt-get install -y nodejs

There may be errors that cannot be found. curl apt-get curl

NPM Installation
curl http://npmjs.org/install.sh | sudo shsudo apt-get install curl
Node VS NodeJS?

NPM, node installed after successful execution:

node -v

Found an error

-bash: /usr/sbin/node: No such file or directory

However, you can use

nodejs -v

The cause of this problem:

There is a naming conflict with the node package (amateur Packet Radio node program), and the Nodejs binary have been Renam Ed from node to Nodejs. You'll need to Symlink/usr/bin/node To/usr/bin/nodejs or you could uninstall the amateur Packet Radio node program to AV OID that conflict.

Of course, the direct use nodejs命令 can also execute node program, but subsequent if the installation of modules will appear node 未定义 error

The workaround is to add a link:

You need to manually create a symlink /usr/bin/node . Shortcut for bash compatible shells:

sudo ln -s `which nodejs` /usr/bin/node

Or If you use non-standard shells, just hardcode the path to find with which Nodejs:

/usr/bin/nodejs /usr/bin/node
Npm:permission Denied

There is a problem with NPM installation Hexo:

node scripts/build_highlight_alias.js > highlight_alias.jsonsh: 1: cannot create highlight_alias.json: Permission denied

Change to sudo still error.

Solution See official Guide:https://docs.npmjs.com/getting-started/fixing-npm-permissions

Reference documents
    • https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
    • Http://www.cnblogs.com/seanlv/archive/2011/09/24/2189719.html
    • https://stackoverflow.com/questions/18130164/nodejs-vs-node-on-ubuntu-12-04
    • Https://github.com/hexojs/hexo-util/issues/9

Gracefully play Linux-3-ubuntu under Nodejs installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.