联网机器安装NPM包
以 http-server
为例:
1 2 3 4 5 6 7 8 9
| C:\Users\DELL>npm -v 6.13.4
C:\Users\DELL>node -v v12.16.1
npm install http-server -g
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| npm config list
C:\Users\DELL>npm config list ; cli configs metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/6.13.4 node/v12.16.1 win32 x64"
; builtin config undefined prefix = "C:\\Users\\DELL\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files\nodejs\node.exe ; cwd = C:\Users\DELL ; HOME = C:\Users\DELL ; "npm config ls -l" to show all defaults.
|
查看 C:\\Users\\DELL\\AppData\\Roaming\\npm
目录,截图如下:


通过ftp工具拷贝到未联网服务器
1 2 3 4
|
http-server http-server.cmd
|
如图:

如图:

安装启动
1 2 3 4 5 6 7 8 9 10 11 12
| npm install /root/.npm/node_modules/http-server -g
http-server /test/webapp -p 8013
netstat -lnpt
curl -o /dev/null -s -w %{http_code} -X GET "192.125.30.82:8013/pages/tsjb/lzsp.html" -H "accept: text/html" curl -X GET "192.125.30.82:8013/pages/tsjb/lzsp.html" -H "accept: text/html"
|
参考:
https://stackoverflow.com/questions/43064107/how-to-install-npm-package-while-offline/58744517#58744517
npm install
npm 模块安装机制简介
NPM离线包
npmbox