按照nodejs官方说明,下载二进制包,然后按照官方说明就行配置:
How to install Node.js via binary archive on Linux?
Unzip the binary archive to any directory you wanna install Node, I use /usr/local/lib/nodejs
VERSION=v10.15.0
DISTRO=linux-x64
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-$VERSION-$DISTRO.tar.xz -C /usr/local/lib/nodejs
tar xvJf node-v12.18.3-linux-x64.tar.xz -C /usr/local/lib/nodejs
Set the environment variable
vi /etc/profile, add below to the end
# Nodejs
VERSION=v10.15.0
DISTRO=linux-x64
export PATH=/usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin:$PATH
Refresh profile
source /etc/profile
Test installation using
$ node -v
$ npm version
$ npx -v
the normal output is:
➜ node -v
v10.15.1
➜ npm version
{ npm: '6.4.1',
ares: '1.15.0',
cldr: '33.1',
http_parser: '2.8.0',
icu: '62.1',
modules: '64',
napi: '3',
nghttp2: '1.34.0',
node: '10.15.1',
openssl: '1.1.0j',
tz: '2018e',
unicode: '11.0',
uv: '1.23.2',
v8: '6.8.275.32-node.12',
zlib: '1.2.11' }
设置npn淘宝镜像
npm config set registry https://registry.npm.taobao.org
安装mbtiles-server
npm install mbtiles-server -g
验证安装
mbtiles-server --help
nohup mbtiles-server --cache /home/nodejs/mbtiles > nohup.out 2>&1 &
网友评论