//安装报错无法连接到服务器:
root@ok3568:/home/forlinx/3ddemo/3ddemo# npm install -g http-server
npm ERR! network timeout at: https://registry.npmjs.org/http-server
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2038-05-08T10_41_44_723Z-debug.log
//解决方法:
root@ok3568:/home/forlinx/3ddemo/3ddemo# npm config set registry https://registry.npm.taobao.org/
root@ok3568:/home/forlinx/3ddemo/3ddemo# export http_proxy=http://host.resona.top:9590
root@ok3568:/home/forlinx/3ddemo/3ddemo# export https_proxy=http://host.resona.top:9590
root@ok3568:/home/forlinx/3ddemo/3ddemo# npm install -g http-server
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/http-server failed, reason: certificate has expired
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2038-05-08T10_43_11_679Z-debug.log
证书过期问题:
root@ok3568:/home/forlinx/3ddemo/3ddemo# npm install -g http-server
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/http-server failed, reason: certificate has expired
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2038-05-08T10_45_03_437Z-debug.log
//解决方法:
root@ok3568:/home/forlinx/3ddemo/3ddemo# npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
root@ok3568:/home/forlinx/3ddemo/3ddemo# npm config set strict-ssl false
root@ok3568:/home/forlinx/3ddemo/3ddemo# npm install
npm WARN saveError ENOENT: no such file or directory, open '/home/forlinx/3ddemo/3ddemo/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/forlinx/3ddemo/3ddemo/package.json'
npm WARN 3ddemo No description
npm WARN 3ddemo No repository field.
npm WARN 3ddemo No README data
npm WARN 3ddemo No license field.
up to date in 1.731s
//安装所需软件
root@ok3568:/home/forlinx/3ddemo/3ddemo# npm install -g http-server
/usr/local/bin/http-server -> /usr/local/lib/node_modules/http-server/bin/http-server
npm WARN notsup Unsupported engine for http-server@14.1.1: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: http-server@14.1.1
npm WARN notsup Unsupported engine for html-encoding-sniffer@3.0.0: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: html-encoding-sniffer@3.0.0
npm WARN notsup Unsupported engine for whatwg-encoding@2.0.0: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: whatwg-encoding@2.0.0
+ http-server@14.1.1
added 44 packages from 42 contributors in 111.782s