[Raspberry Pi] Install node environment

Source: Internet
Author: User
Tags install node

This article is not a compiled installation of node, it is said to take a long time, so at first I was rejected. This article shows how to deploy the compiled execution file for Ndoe.

Node's official Web download directory itself has compiled executable files for arm. Address is here: HTTPS://NODEJS.ORG/DIST/V4.2.1/

Choose the right version

Download the appropriate version for the Raspberry Pi, the appropriate version of the choice is this: SSH login on the Raspberry Pi, the console will display the relevant information:

See the 4th line above the text (blank line ignored) The last word has no armv71, perfect match.

If you have a direct Raspberry Pi on the display device, then you can also enter it through the terminal window

uname -A

To display System Information

You can also find the relevant system architecture information ARMV71

Selected version of the information I can only provide such two, in addition, my hardware is Raspberry Pi 2 generation B type (E14), if the same hardware, directly select the ARMV71 version of the good, good choice of version, you can download.

Download
HTTPS://nodejs.org/dist/v4.2.1/node-v4.2.1-linux-armv7l.tar.gz

Or you could use your PC to get a good, sftp, Raspberry Pi.

Extract
tar xvzf node-v4. 2.1-linux-armv7l. tar. gz
Move
MV node-v4. 2.1-linux-armv7l/usr/local/bin

Configuration

To make the node and NPM commands available in all directories, either create a link to node and NPM in the existing path path, or add the path to node and NPM in path. I chose the link scheme.

Node link
sudo Ln /usr/local/bin/node-v4. 2.1-linux-armv71/bin/node/usr/local/bin/node
NPM Links

The NPM in the Node-v4.2.1-linux-armv71/bin directory is the default for soft links to node-v4.2.1-linux-armv71/lib/node_modules/npm/bin/ Npm-cli.js due to loading path and current working directory problems, direct hard chain or soft chain will have problems, two in node-v4.2.1-linux-armv71/lib/node_modules/npm/bin/ The directory also has a bash script called NPM, which is linked to NPM.

sudo Ln -s/usr/local/bin/node-v4. 2.1-LINUX-ARMV71/LIB/NODE_MODULES/NPM/BIN/NPM/USR/LOCAL/BIN/NPM

Try to npm-v found an error, said to be unable to find the Npmlog module, but also the working directory problem.

Open this script and find that the script can be qualified for a minor makeover.

Post the modified file content:

#!/bin/SH(Set-O igncr)2>/dev/NULL&& Set-o igncr; # Cygwin encoding Fixbasedir=$(dirname`Readlink-F $0') CD $basedir Case`uname`inch*cygwin*) basedir= ' Cygpath-W "$basedir"`;;EsacNode_exe="$basedir/node.exe"if! [-X"$NODE _exe"]; ThenNode_exe=nodefiNpm_cli_js="$basedir/node_modules/npm/bin/npm-cli.js"if! [-X"$NPM _cli_js"]; ThenNpm_cli_js=npm-Cli.jsfi Case`uname`inch*cygwin*) Npm_prefix=`"$NODE _exe" "$NPM _cli_js"Prefix-g ' Npm_prefix_npm_cli_js="$NPM _prefix/node_modules/npm/bin/npm-cli.js"    if[-F"$NPM _prefix_npm_cli_js"]; ThenNpm_cli_js="$NPM _prefix_npm_cli_js"    fi    ;;Esac"$NODE _exe" "$NPM _cli_js" "[email protected]"
Confirm the effect

[Raspberry Pi] Install node environment

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.