[Raspberry Pi] installing the node Environment

Source: Internet
Author: User

[Raspberry Pi] installing the node Environment
This article is not about node compilation and installation. It is said that it takes a long time, so at first I refused. This article shows how to deploy ndoe compiled execution files. The download directory on the node official website contains the compiled execution files for arm. Address here: https://nodejs.org/dist/v4.2.1/ select the right Version Download the right version to get on Raspberry Pi, the right version of the choice is like this: SSH login on Raspberry Pi, the console will display the relevant information: the last word of the above 4th lines of text (ignore empty lines) is not armv71, perfect match. If you have a display device directly connected to Raspberry Pi, then, you can enter uname-a in the terminal window to display the system information. You can also find the information about the system architecture of armv71. Currently, I can only provide these two types of information, in addition, my hardware is Raspberry Pi 2 generation B type (E14). If it is the same hardware, you can simply select armv71. You can download it after you select the desired version. Download the https://nodejs.org/dist/v4.2.1/node-v4.2.1-linux-armv7l.tar.gz or use your PC, sftp to Raspberry Pi. Decompress the tar xvzf node-v4.2.1-linux-armv7l.tar.gz to move the mv node-v4.2.1-linux-armv7l/usr/local/bin configuration to make the node and npm commands valid in all directories, or to create a link between node and npm in an existing PATH, or add the node and npm paths to the PATH. I selected the link scheme. Node link sudo ln/usr/local/bin/node-v4.2.1-linux-armv71/bin/node/usr/local/bin/nodenpm link npm in node-v4.2.1-linux-armv71/bin directory is soft chain by default to node-v4.2.1-linux-armv71/lib /node_modules/npm/bin/npm-cli.js due to loading path and current working directory problems, there will be problems with direct hard chain or soft chain, two in the node-v4.2.1-linux-armv71/lib/node_modules/npm/bin/directory there is a bash script named npm, just link this npm. Sudo ln-s/usr/local/bin/node-v4.2.1-linux-armv71/lib/node_modules/npm/bin/npm/usr/local/bin/npm try npm-v and an error is found, the npmlog module is not found, which is also a working directory problem. Open the script and find that the script is qualified for a slight transformation. Paste the modified file content:

#!/bin/sh(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fixbasedir=$(dirname `readlink -f $0`)cd $basedircase `uname` in    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;esacNODE_EXE="$basedir/node.exe"if ! [ -x "$NODE_EXE" ]; then  NODE_EXE=nodefiNPM_CLI_JS="$basedir/node_modules/npm/bin/npm-cli.js"if ! [ -x "$NPM_CLI_JS" ]; then  NPM_CLI_JS=npm-cli.jsficase `uname` in  *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" ]; then      NPM_CLI_JS="$NPM_PREFIX_NPM_CLI_JS"    fi    ;;esac"$NODE_EXE" "$NPM_CLI_JS" "$@"

Validate


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.