[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