[Raspberry Pi] install the node environment and Raspberry Pi node Environment

Source: Internet
Author: User

[Raspberry Pi] install the node environment and Raspberry Pi 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 an appropriate version

Uname-

To display system information

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

Tar xvzf node-v4.2.1-linux-armv7l.tar.gzMobile

mv node-v4.2.1-linux-armv7l /usr/local/bin

Configuration

To make the node and npm commands effective in all directories, you must either create a connection between node and npm in the existing PATH, or add the PATH of node and npm to the PATH. I selected the link scheme.

Node connection
sudo ln /usr/local/bin/node-v4.2.1-linux-armv71/bin/node /usr/local/bin/node
Npm Link

Npm in the 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 load 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

An error occurred while trying npm-v. It indicates that the npmlog module could not be found and the working directory was faulty.

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.