{"id":7425,"date":"2022-07-08T09:53:55","date_gmt":"2022-07-08T01:53:55","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=7425"},"modified":"2022-07-08T13:10:40","modified_gmt":"2022-07-08T05:10:40","slug":"nodeos-operating-system","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/nodeos-operating-system.html","title":{"rendered":"NodeOS\u64cd\u4f5c\u7cfb\u7edf"},"content":{"rendered":"
\n

\u672c\u6587\u7531lrxjmw.cn\u56e2\u961f\u6210\u5458\u51af\u632f\u534e<\/span>\u6574\u7406\u53d1\u5e03\uff0c\u539f\u6587\u6765\u81ea\uff1a\u4f2f\u4e50\u5728\u7ebf<\/a>\u3002<\/p>\n<\/div>\n\n\n\n
\u5bfc\u8bfb<\/td>\n\u6211\u60f3\u5927\u591a\u6570\u4eba\u542c\u8bf4\u8fc7\u00a0Node.js\uff0c\u4f46\u662f\u4f60\u542c\u8bf4\u8fc7 NodeOS \u5417\uff1f\u4e00\u4e2a\u7528 Node.js \u5199\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0cNodeOS \u7528 Linux \u5185\u6838\u6765\u5904\u7406\u5404\u79cd\u5e95\u5c42\u4efb\u52a1\uff0c\u6bd4\u5982\u786c\u4ef6\u901a\u8baf\u4ec0\u4e48\u7684\uff0c\u4f46\u662f\u9664\u6b64\u4e4b\u5916\uff0c\u4f7f\u7528\u7684\u90fd\u662f Node.js\u3002NodeOS \u7684\u5f00\u53d1\u59cb\u4e8e\u4e24\u5e74\u524d\uff0c\u521b\u5efa\u8005\u7684\u76ee\u7684\u5f88\u7b80\u5355\uff0c\u4ed6\u53ea\u662f\u597d\u5947\uff0c\u201c\u662f\u5426\u6709\u53ef\u80fd\u4ec5\u4f7f\u7528 Node.js \u521b\u5efa\u4e00\u4e2a\u64cd\u4f5c\u7cfb\u7edf\uff1f\u201d\u6211\u4eec\u5df2\u7ecf\u770b\u5230\u4e86 Node.js \u5728\u8fd9\u51e0\u5e74\u5df2\u7ecf\u53d6\u5f97\u5982\u6b64\u8fc5\u731b\u7684\u53d1\u5c55\uff0c\u90a3\u4e48\u6211\u4eec\u4e3a\u4f55\u4e0d\u8ba9\u5b83\u66f4\u9177\u4e00\u4e9b\u5462\uff1f\u7528\u5b83\u505a\u4e2a\u64cd\u4f5c\u7cfb\u7edf\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"nodeOS_01\"<\/p>\n

\u7528\u6237\u81ea\u4e3b\u7684\u72ec\u7acb\u6587\u4ef6\u7cfb\u7edf<\/strong><\/div>\n

NodeOS \u5f15\u5165\u4e86\u4e00\u4e2a\u6709\u8da3\u7684\u7279\u6027\uff1a\u6240\u6709\u7684\u7528\u6237\u90fd\u6709\u4e00\u4e2a\u72ec\u7acb\u7684\u6587\u4ef6\u7cfb\u7edf\uff0c\u4ed6\u4eec\u5728\u4e00\u4e2a\u7b80\u5355\u7684\u6587\u4ef6\u7cfb\u7edf\u4e2d\u5b8c\u6210\u5404\u79cd\u5de5\u4f5c\u3002\u56e0\u4e3a\u4ed6\u4eec\u7684\u201c\u4e3b\u76ee\u5f55\u201d\u4e8b\u5b9e\u4e0a\u5c31\u662f\u4ed6\u4eec\u81ea\u5df1\u7684\u6587\u4ef6\u7cfb\u7edf\u7684\u6839\uff08root\uff09\uff0c\u6240\u4ee5\u4ed6\u4eec\u53ef\u4ee5\u4e0d\u9700\u8981\u4efb\u4f55\u8d85\u7ea7\u6743\u9650\u5c31\u53ef\u4ee5\u5c06\u8f6f\u4ef6\u5305\u5b89\u88c5\u5230\u7cfb\u7edf\u4e2d\uff0c\u4e5f\u4e0d\u9700\u8981\u914d\u7f6e\u4ec0\u4e48\uff0c\u56e0\u4e3a\u8f6f\u4ef6\u5305\u9ed8\u8ba4\u5c31\u5b89\u88c5\u5728\u4ed6\u4eec\u81ea\u5df1\u7684\u4e3b\u76ee\u5f55\u91cc\u9762\u3002\u6b64\u5916\uff0c\u8fd9\u6837\u4e5f\u63d0\u4f9b\u4e86\u826f\u597d\u7684\u5b89\u5168\u6027\uff0c\u5982\u679c\u9ed1\u5ba2\u653b\u5165\u5230\u4e86\u67d0\u4e2a\u8d26\u6237\uff0c\u90a3\u4e48\u53ea\u80fd\u8bbf\u95ee\u5230\u8be5\u7528\u6237\u6240\u5728\u7684\u90e8\u5206\uff0c\u6700\u7ec8\u7684\u7ed3\u679c\u5c31\u662f\u9ed1\u5ba2\u5e76\u4e0d\u80fd\u7531\u6b64\u5f71\u54cd\u5230\u6574\u4e2a\u7cfb\u7edf\u3002<\/p>\n

Node.js \u548c NPM<\/strong><\/div>\n

\u4f60\u53ef\u4ee5\u60f3\u60f3\uff0c\u5982\u679c\u4e00\u4e2a\u64cd\u4f5c\u7cfb\u7edf\u4f7f\u7528 Node.js\uff0c\u90a3\u5c31\u610f\u5473\u7740\u6240\u6709\u5728 NPM \u4e2d\u53ef\u7528\u7684\u5305\u540c\u65f6\u4e5f\u90fd\u662f NodeOS \u7684\u8f6f\u4ef6\u5305\u3002\u5728\u5199\u4f5c\u672c\u6587\u65f6\uff0c\u5df2\u7ecf\u6709\u4e86\u8d85\u8fc7 21 \u4e07\u7684\u8f6f\u4ef6\u5305\uff0c\u800c\u4e14\u6bcf\u5206\u6bcf\u79d2\u90fd\u5728\u4e0d\u65ad\u589e\u957f\uff0c\u5982\u679c\u51e0\u5e74\u4ee5\u540e\uff0cNodeOS \u6709\u4e86\u4e00\u767e\u4e07\u5e94\u7528\uff0c\u90a3\u4e5f\u6ca1\u4ec0\u4e48\u597d\u5947\u602a\u7684\u3002<\/p>\n

\u57fa\u4e8e Linux \u5185\u6838<\/strong><\/div>\n

\u8fd9\u770b\u8d77\u6765\u5e76\u4e0d\u7b97\u4ec0\u4e48\uff0cLinux \u662f\u5927\u591a\u6570\u670d\u52a1\u5668\u6240\u91c7\u7528\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002\u56e0\u4e3a NodeOS \u662f\u57fa\u4e8e Linux \u5185\u6838\u7684\uff0c\u6240\u4ee5\u4f60\u53ea\u9700\u8981\u5f88\u5c11\u7684\u4fee\u6539\u5c31\u53ef\u4ee5\u4f7f\u7528\u90a3\u4e9b\u7ed9\u5176\u5b83\u7684 Linux \u53d1\u884c\u7248\u5f00\u53d1\u7684\u5e94\u7528\u4e86\u3002<\/p>\n

\u4e0d\u597d\u7684\u6d88\u606f<\/strong><\/div>\n

\u6211\u975e\u5e38\u5e0c\u671b NodeOS \u662f\u4e00\u4e2a\u5df2\u7ecf\u5b8c\u6210\u7684\u4f5c\u54c1\uff0c\u4f46\u662f\uff0c\u5b83\u73b0\u5728\u8fd8\u4e0d\u662f\u3002\u5b83\u4ecd\u7136\u7f3a\u5c11\u4e00\u4e9b\u670d\u52a1\u5668\u64cd\u4f5c\u7cfb\u7edf\u6240\u5fc5\u9700\u7684\u5173\u952e\u529f\u80fd\u3002\u6bd4\u5982\uff0c\u7f3a\u5931\u5b8c\u6574\u7684 BASH \u5de5\u5177\u96c6\uff0c\u5305\u62ec ps\u3001tail\u3001nano \u548c grep \u7b49\u90fd\u6ca1\u6709\u3002\u66f4\u7cdf\u7cd5\u7684\u662f\uff0c\u4f60\u4e5f\u4e0d\u80fd\u628a\u5b83\u5f53\u6210\u684c\u9762\u64cd\u4f5c\u7cfb\u7edf\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b83\u6ca1\u6709 GUI\u3002\u5f53\u7136\uff0c\u4f60\u53ef\u4ee5\u5b9e\u73b0\u4e00\u4e9b\u7f3a\u5931\u7684\u529f\u80fd\uff0c\u53ea\u9700\u8981\u4f7f\u7528\u4e00\u70b9\u70b9 JavaScript\uff0c\u4f46\u662f\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u8fd9\u4e9b\u529f\u80fd\u73b0\u5728\u90fd\u8fd8\u6ca1\u6709\uff0c\u771f\u7cdf\u7cd5\u3002<\/p>\n

\u597d\u5427\uff0c\u90a3\u6211\u53ef\u4ee5\u8bd5\u8bd5 NodeOS \u5417\uff1f<\/strong><\/div>\n
\u4f7f\u7528 Docker \u6765\u4f53\u9a8c<\/strong><\/span><\/div>\n

\u6700\u5bb9\u6613\u3001\u6700\u5feb\u6377\u7684\u4f53\u9a8c NodeOS \u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n

    \n
  1. \u4e00\u53f0\u8fd0\u884c Mac OSX \u6216 Linux \u8ba1\u7b97\u673a\uff0c\u4e5f\u8bb8 Windows \u4e5f\u53ef\u4ee5\uff0c\u4f46\u662f\u6211\u6ca1\u8bd5\u8fc7\u3002<\/li>\n
  2. Docker\u3002<\/li>\n<\/ol>\n

    \u5f53\u4f60\u5b89\u88c5\u597d Docker \u4e4b\u540e\uff0c\u8fd0\u884c\u4e00\u4e2a NodeOS \u5b9e\u4f8b\u662f\u5f88\u5bb9\u6613\u7684\u3002\u4f60\u53ea\u9700\u8981\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u5c31\u53ef\u4ee5\u4e86\uff0c Docker \u4f1a\u4e3a\u4f60\u5b8c\u6210\u8fd9\u4e00\u5207\uff1a<\/p>\n

    sudo docker run -t -i nodeos\/nodeos<\/pre>\n

    \"nodeOS_02\"<\/p>\n

    \u5f53\u4f60\u8fd0\u884c\u4e86\u4e0a\u8ff0\u547d\u4ee4\uff0cDocker \u4f1a\u81ea\u52a8\u4ece\u4ed3\u5e93\u4e0b\u8f7d NodeOS \u7684\u955c\u50cf\uff0c\u5e76\u5c06\u5176\u5b89\u88c5\u5230\u4e00\u4e2a\u865a\u62df\u73af\u5883\u4e2d,\u5b89\u88c5\u597d\u4e4b\u540e\uff0c\u4f1a\u6253\u5f00\u4e00\u4e2a\u8fde\u63a5\u5230 NodeOS \u7684 SSH \u4f1a\u8bdd\u3002<\/p>\n

    \u4e0d\u7528Docker\u5462\uff1f<\/strong><\/span><\/div>\n

    \u6709\u4e9b\u60c5\u51b5\u4e0b\u4f60\u4e5f\u8bb8\u4e0d\u80fd\u4f7f\u7528 Docker \u6765\u4f53\u9a8c\uff0c\u6216\u8005\u662f\u4f60\u60f3\u4f53\u9a8c\u4e00\u4e0b\u6700\u65b0\u7248\u672c\u7684 NodeOS \u3002\u5728\u5199\u4f5c\u672c\u6587\u65f6\uff0cNodeOS \u7684\u955c\u50cf\u5df2\u7ecf\u662f\u4e24\u4e2a\u6708\u524d\u751f\u6210\u7684\u4e86\uff0c\u800c\u5f00\u53d1\u7248\u672c\u5219\u662f\u516d\u5929\u524d\u66f4\u65b0\u7684\u3002\u6240\u4ee5\uff0c\u5982\u679c\u4f60\u5e0c\u671b\u4f7f\u7528\u6700\u65b0\u7248\u672c\uff0c\u4f60\u5e94\u8be5\u4ece\u6e90\u4ee3\u7801\u5f00\u59cb\u3002\u8fd9\u4e5f\u4e0d\u7b97\u5f88\u96be\uff0c\u4f46\u662f\u8981\u82b1\u8d39\u4e00\u4e9b\u65f6\u95f4\u3002\u4f60\u9700\u8981\uff1a<\/p>\n

      \n
    1. \u4e00\u53f0\u8fd0\u884c Linux \u7684\u8ba1\u7b97\u673a\u3002\u4f60\u53ef\u4ee5\u5728 OS X \u4e0a\u7f16\u8bd1\u5b83\uff0c\u4f46\u662f\u8de8\u5e73\u53f0\u7f16\u8bd1\u9700\u8981\u82b1\u8d39\u5f88\u591a\u65f6\u95f4\uff0c\u5bf9\u4e8e Windows \u4e5f\u5982\u6b64\u3002<\/li>\n
    2. Linux \u7f16\u8bd1\u6784\u5efa\u76f8\u5173\u7684\u5de5\u5177\uff08make\u3001g++\u3001gcc\u3001autoconf\uff09\u3002<\/li>\n
    3. Qemu\u3002<\/li>\n
    4. \u65f6\u95f4\uff0c\u771f\u7684\u9700\u8981\u5f88\u591a\u3002<\/li>\n<\/ol>\n

      \u5982\u679c\u4e07\u4e8b\u4ff1\u5907\uff0c\u4f60\u5c31\u53ef\u4ee5\u4ece\u6e90\u4ee3\u7801\u5f00\u59cb\u7f16\u8bd1\u4e86\uff1a<\/p>\n

        \n
      1. \u4e0b\u8f7d\u9879\u76ee\u6e90\u4ee3\u7801\uff1abash git clone git@github.com:NodeOS\/NodeOS.git\u3002<\/li>\n
      2. \u4f7f\u7528\u4e0b\u5217\u547d\u4ee4\u7f16\u8bd1\uff1a\u00a0cd NodeOS\u00a0\u5e76\u00a0npm install\u3002<\/li>\n
      3. \u6267\u884c\u00a0bash npm start\u6765\u5728 Qemu \u4e2d\u8fd0\u884c NodeOS\u3002<\/li>\n<\/ol>\n

        \u5f53\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5728 NodeOS \u7684 shell \u4e2d\u6267\u884c ls\u547d\u4ee4\u6765\u770b\u770b\u5b83\u662f\u5426\u5de5\u4f5c\u4e86\u3002\u8f93\u51fa\u7c7b\u4f3c\u5982\u4e0b\uff1a<\/p>\n

        [ 'etc', 'lib', 'lib64', 'root', 'bin', 'sys', 'usr', 'share', 'proc' ]<\/pre>\n

        \u5982\u679c\u663e\u793a\u5982\u4e0a\uff0c\u8bf4\u660e\u4e00\u4e9b\u57fa\u672c\u7684\u547d\u4ee4\u53ef\u4ee5\u5de5\u4f5c\u4e86\u3002\u4f46\u662f\u5982\u679c\u6211\u4eec\u60f3\u8981\u77e5\u9053\u7f51\u5361\u5730\u5740\u5462\uff1f\u5728 Linux \u4e0b\uff0c\u8fd9\u4e2a\u547d\u4ee4\u662f \u00a0ifconfig>\u00a0\uff0c\u8ba9\u6211\u4eec\u8bd5\u8bd5\uff1a<\/p>\n

        command not found: ifconfig<\/pre>\n

        \u770b\u8d77\u6765\u6ca1\u6709ifconfig\u547d\u4ee4\uff0c\u8fd9\u662f\u56e0\u4e3a NodeOS \u9ed8\u8ba4\u6ca1\u6709ifconfig\u547d\u4ee4\u3002\u73b0\u5728\u600e\u4e48\u529e\uff1f\u5f88\u7b80\u5355\uff0cNodeOS \u6709\u4e00\u4e2a\u96c6\u6210\u7684\u5305\u7ba1\u7406\u5668\uff08\u7c7b\u4f3capt\u6216yum\uff09 \uff0c\u53eb\u505anpkg\uff0c\u5b83\u662f\u57fa\u4e8e Node \u7684 NPM \u7684\uff0c\u5f88\u5bb9\u6613\u4f7f\u7528\u3002\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u5f88\u65b9\u4fbf\u7684\u5b89\u88c5ifconfig\u00a0\uff1a<\/p>\n

        npkg install bin-ifconfig<\/pre>\n

        \u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0cifconfig\u547d\u4ee4\u73b0\u5728\u5c31\u53ef\u4ee5\u5728shell\u4e2d\u4f7f\u7528\u4e86\u3002\u6211\u4eec\u518d\u6b21\u8bd5\u7740\u6267\u884c\u4e00\u4e0b\uff0c\u8f93\u51fa\u7c7b\u4f3c\u5982\u4e0b\uff1a\uff08\u6211\u66ff\u6362\u4e86\u5176\u4e2d\u7684 MAC \u5730\u5740\uff09\uff1a<\/p>\n

        eth0: flags=8863 mtu 1500\r\n  ether 01:23:45:67:89:ab \r\n  inet6 f0cd::ef01:0203:0405:181%en1 prefixlen 64 scopeid 0x5 \r\n  inet 192.168.0.21 netmask 0xffffff00 broadcast 192.168.0.21\r\n  nd6 options=1\r\n  media: autoselect\r\n  status: active<\/pre>\n

        \u5982\u679c\u4f60\u7684\u8f93\u51fa\u4e5f\u7c7b\u4f3c\u5982\u4e0a\uff0c\u90a3\u8bf4\u660e\u5b83\u53ef\u4ee5\u5de5\u4f5c\u4e86\uff0c\u4f60\u5df2\u7ecf\u6210\u529f\u5730\u5b89\u88c5\u4e86\u4f60\u7684\u7b2c\u4e00\u4e2a NodeOS \u5e94\u7528\uff1aifconfig\u3002<\/p>\n

        \u5b83\u662f\u53ef\u4ee5\u5de5\u4f5c\u4e86\uff0c\u7136\u800c\u6211\u4eec\u53ef\u4ee5\u7528\u8fd9\u4e2a\u64cd\u4f5c\u7cfb\u7edf\u505a\u4ec0\u4e48\u5462\uff1f<\/strong><\/div>\n

        \u5982\u679c\u6211\u4eec\u53ea\u80fd\u62ff\u8fd9\u4e2a\u7528 Node.js \u5199\u7684\u64cd\u4f5c\u7cfb\u7edf\u505a\u5230\u4f60\u5728 Ubuntu \u6216\u5176\u5b83 Linux \u53d1\u884c\u7248\u4e0a\u4e00\u6837\u7684\uff08\u6216\u66f4\u5c11\u7684\uff09\u4e8b\u60c5\uff0c\u90a3\u5b83\u6709\u4ec0\u4e48\u4ef7\u503c\uff1f\u5176\u5b9e\uff0c\u6574\u4e2a\u4e8b\u60c5\u4e2d\u6700\u6709\u8da3\u7684\u5730\u65b9\u662f\u6240\u6709\u7684\u4e1c\u897f\u90fd\u662f Node.js \u5f00\u53d1\u7684\u3002\u8fd9\u610f\u5473\u7740\u6211\u4eec\u53ef\u4ee5\u53ea\u9700\u8981\u4f7f\u7528 Node.js\u00a0\u5c31\u53ef\u4ee5\u5f00\u53d1\u6211\u4eec\u7684\u5e94\u7528\u4e86\u3002\u6bd4\u5982\uff0cNodeOS \u91cc\u6ca1\u6709\u9ed8\u8ba4\u5b9e\u73b0\u7684 man \u547d\u4ee4\uff0c\u5b83\u7528\u4e8e\u663e\u793a\u5176\u5b83\u547d\u4ee4\u7684\u5e2e\u52a9\u4fe1\u606f\u3002\u4e0d\u7528\u62c5\u5fc3\uff0c\u5b9e\u73b0\u5b83\u5f88\u7b80\u5355\u3002<\/p>\n

        \"nodeOS_03\"<\/p>\n

        \u9996\u5148\u8ba9\u6211\u4eec\u6765\u5b89\u88c5\u4e00\u4e2a\u53eb\u505a Hipster \u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u4ee5\u4fbf\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u548c\u7f16\u8f91\u6587\u4ef6\u3002\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1anpm install -g hipster@0.15.0\u3002\u8fd9\u4e2a\u6587\u672c\u7f16\u8f91\u5668\u5f88\u7b80\u5355\uff0c\u9664\u4e86\u7528\u4f5c\u6587\u672c\u7f16\u8f91\u4e4b\u5916\u5565\u4e5f\u5e72\u4e0d\u4e86\uff0c\u4e0d\u8fc7\u5bf9\u4e8e\u6211\u4eec\u6765\u8bf4\u8db3\u591f\u4e86\u3002\u7528 Hipster \u521b\u5efa\u6587\u4ef6\u5f88\u7b80\u5355\uff0c\u8fd0\u884chip filename\u5373\u53ef\uff0c\u5982\uff1ahip package.json\u3002\u8981\u4fdd\u5b58\u6587\u4ef6\u8bf7\u6309\u4e0bCtrl + s\u00a0\uff0c\u9000\u51fa\u6309\u4e0b Ctrl + q\u3002\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u4e00\u4e2a NodeOS \u7684\u4e3b\u5f00\u53d1\u4eba\u5458\u6240\u5f00\u53d1\u7684\u4ee3\u7801\uff0c\u6211\u81ea\u5df1\u5e76\u6ca1\u6709\u771f\u7684\u53bb\u5f00\u53d1\u8fd9\u4e2a\u5e94\u7528\u3002\u6211\u4eec\u4f8b\u5b50\u4e2d\u7684\u539f\u59cb\u4ee3\u7801\u53ef\u4ee5\u5728\u00a0node-bin-man Git \u4ed3\u5e93\u4e2d\u627e\u5230\u3002<\/p>\n

        \u8ba9\u6211\u4eec\u56de\u8fc7\u5934\u6765\u521b\u5efa\u6211\u4eec\u7684\u7b2c\u4e00\u4e2a NodeOS \u5e94\u7528\u3002\u50cf\u6bcf\u4e2a Node.js \u5e94\u7528\uff08\u6216 NPM \u5305\uff09\u4e00\u6837\uff0c\u6211\u4eec\u4ece\u521b\u5efa\u4e00\u4e2apackage.json\u6587\u4ef6\u5f00\u59cb\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n

        {\r\n  \"name\": \"bin-man\",\r\n  \"version\": \"0.0.1\",\r\n  \"description\": \"Format and display manual pages\",\r\n  \"bin\": {\r\n    \"man\": \"man.js\"\r\n  },\r\n  \"repository\": \"https:\/\/github.com\/groundwater\/node-bin-man\",\r\n  \"author\": \"groundwater\",\r\n  \"license\": \"MIT\",\r\n  \"dependencies\": {\r\n    \"blessed\": \"~0.0.22\"\r\n  }\r\n}<\/pre>\n

        \u8fd9\u4e9b\u53c2\u6570\u00a0name\u3001version\u3001author\u3001repository\u3001license\u548cdescription\u662f\u5176\u610f\u81ea\u660e\u7684\u3002\u8fd9\u4e2abin\u96c6\u5408\u662f\u4e00\u4e2aJSON\u7684\u952e\u503c\u5bf9\u5bf9\u8c61\uff0c\u5305\u542b\u4e86\u547d\u4ee4\u540d\u53ca\u5176\u5173\u8054\u7684JavaScript\u6587\u4ef6\u3002\u5728\u6211\u4eec\u7684\u4f8b\u5b50\u4e2d\uff0cman\u547d\u4ee4\u5173\u8054\u5230man.js\u6587\u4ef6\u3002\u800cdependencies\u96c6\u5408\u5305\u542b\u4e86\u8fd9\u4e2a\u5e94\u7528\u6240\u9700\u8981\u7684 NPM\u5305\u7684\u5217\u8868\u3002\u5728\u6211\u4eec\u7684\u4f8b\u5b50\u4e2d\uff0c\u4ee3\u7801\u7684\u4f5c\u8005\u5305\u542b\u4e86 Blessed \u5305\uff0c\u8fd9\u662f\u4e00\u4e2a\u7c7b curses \u7684\u5e93\uff0c\u53ef\u4ee5\u8ba9 Node.js \u652f\u6301\u9ad8\u7ea7\u7ec8\u7aef\u754c\u9762\u7684 API\u3002<\/p>\n

        \u73b0\u5728\u6211\u4eec\u8fdb\u5165\u4e86\u4e3b\u8981\u7684\u90e8\u5206\uff0c\u5b9e\u9645\u7684\u4ee3\u7801\u3002<\/p>\n

        #!\/usr\/bin\/env node<\/pre>\n

        \u8fd9\u4e2a\u90e8\u5206\u53eb\u505a\u91ca\u4f34<\/a>\uff08shebang\uff09\u3002NodeOS \u5b9e\u9645\u4e0a\u5e76\u4e0d\u9700\u8981\u5b83\uff0c\u4f46\u662f\u5b83\u7528\u4e8e\u544a\u8bc9\u64cd\u4f5c\u7cfb\u7edf\u5982\u4f55\u6267\u884c\u4e0b\u9762\u7684\u4ee3\u7801\u3002\u5728\u8fd9\u91cc\u7684\u610f\u601d\u662f\uff0c\u5b83\u544a\u8bc9\u7cfb\u7edf\u4e0b\u9762\u7684\u6bcf\u884c\u4ee3\u7801\u90fd\u9700\u8981\u901a\u8fc7\/usr\/bin\/env node\u547d\u4ee4\u6765\u89e3\u91ca\u6267\u884c\u3002<\/p>\n

        var fs = require('fs');\r\nvar blessed = require('blessed');<\/pre>\n

        \u50cf\u5728 Node.js \u4e2d\u4e00\u6837\uff0crequire()\u00a0\u51fd\u6570\u52a0\u8f7d\u9009\u5b9a\u7684\u5305\u5230\u5185\u5b58\u4e2d\uff0c\u5e76\u5c06\u5176\u4fdd\u5b58\u4e3a\u7279\u5b9a\u7684\u53d8\u91cf\u3002<\/p>\n

        var arg = process.argv[2] || 'bin-man';<\/pre>\n

        man\u547d\u4ee4\u7684\u6807\u51c6\u884c\u4e3a\u662f\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u8981\u67e5\u770b\u7684\u547d\u4ee4\u65f6\uff0c\u5c31\u663e\u793a\u5b83\u81ea\u5df1\u7684\u5e2e\u52a9\u4fe1\u606f\u3002\u5728\u6211\u4eec\u7684\u4ee3\u7801\u793a\u4f8b\u4e2d\u4e5f\u4e00\u6837\uff1a\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff08\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f man \u672c\u8eab\uff09\uff0c\u90a3\u4e48\u8be5\u53c2\u6570\u7684\u9ed8\u8ba4\u503c\u662fbin-man\u3002<\/p>\n

        var path = process.env.HOME + \"\/lib\/node_modules\/\" + arg + \"\/README.md\";\r\n \r\ntry{\r\n  var readme = fs.readFileSync(path, 'utf-8');\r\n}catch(e){\r\n  console.log('No README.md for Package ',arg);\r\n  process.exit(-1);\r\n}<\/pre>\n

        \u5728\u8fd9\u91cc\uff0c\u7a0b\u5e8f\u68c0\u67e5\u7ed9\u5b9a\u7684\u5e94\u7528\u662f\u5426\u6709\u4e00\u4e2areadme\u6587\u4ef6\u3002\u5728 NodeOS \u4e2d\uff0c\u6bcf\u4e2a\u5e94\u7528\u7684\u5b89\u88c5\u8def\u5f84\u662f\u5176\u4e3b\u76ee\u5f55\uff08\/\uff09\u4e0b\u7684lib\/node_modules\u3002\u5982\u679cREADME.md\u6587\u4ef6\u5b58\u5728\uff0c\u5c31\u5c06\u5176\u5185\u5bb9\u4fdd\u5b58\u5230readme\u53d8\u91cf\u4e2d\u3002\u5426\u5219\uff0c\u663e\u793a\u4e00\u4e2a\u9519\u8bef\u4fe1\u606f\u5e76\u9000\u51fa\u3002<\/p>\n

        \/\/ Create a screen object.\r\nvar screen = blessed.screen();\r\n \r\nvar box = blessed.box({\r\n  content: readme,\r\n  alwaysScroll:true,\r\n  scrollable: true,\r\n});\r\n \r\n\/\/ Append our box to the screen.\r\nscreen.append(box);<\/pre>\n

        Blessed \u6709\u4e00\u4e2a\u975e\u5e38\u7b80\u5355\u7684 API\uff0c\u8981\u663e\u793a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u5f88\u5bb9\u6613\uff0c\u53ea\u9700\u8981\u521b\u5efa\u4e00\u4e2abox\uff0c\u7136\u540e\u8f7d\u5165\u5185\u5bb9\u5373\u53ef\u3002<\/p>\n

        screen.key(['escape', 'q', 'C-c'], function(ch, key) {\r\n  return process.exit(0);\r\n});<\/pre>\n

        \u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u627e\u4e2a\u9000\u51faman\u5e94\u7528\u7684\u65b9\u6cd5\u3002\u6211\u4eec\u7ec4\u5408\u4e86escape\u3001q\u6216 emacs \u98ce\u683c\u7684C-c\u6765\u9000\u51fa\u5e94\u7528\u3002<\/p>\n

        screen.key(['space','f','j','n'], function(ch, key) {\r\n  box.scroll(box.height);\r\n  screen.render();\r\n});\r\n \r\nscreen.key(['down'], function(ch, key) {\r\n  box.scroll(1);\r\n  screen.render();\r\n});\r\n \r\nscreen.key(['up'], function(ch, key) {\r\n  box.scroll(-1);\r\n  screen.render();\r\n});\r\n \r\nscreen.key(['b','k','p'], function(ch, key) {\r\n  box.scroll(-box.height);\r\n  screen.render();\r\n});<\/pre>\n

        \u6211\u4eec\u4f7f\u7528\u65b9\u5411\u952e\u6765\u4e0a\u6eda\u548c\u4e0b\u6eda\uff0c\u7528space\u3001f\u3001j\u6216n\u5411\u4e0b\u7ffb\u9875\uff0cb\u3001k\u00a0\u6216p\u5411\u4e0a\u7ffb\u9875\u3002<\/p>\n

        box.focus();\r\nscreen.render();<\/pre>\n

        \u6700\u540e\uff0c\u6211\u4eec\u8ba9\u5e94\u7528\u5c06\u8f93\u5165\u7126\u70b9\u653e\u5230box\u00a0\uff0c\u6211\u4eec\u5728\u8fd9\u91cc\u521b\u5efa\u548c\u6e32\u67d3\u6240\u6709\u5185\u5bb9\u3002\u628a\u4e0a\u9762\u7f16\u8f91\u7684\u8fd9\u4e2a\u6587\u4ef6\u5b58\u653e\u5230 \u00a0\/lib\/node_modules\/bin-man\u76ee\u5f55\u4e0b\uff08\u540d\u5b57\u662fman.js\uff09\uff0c\u5e76\u52a0\u4e00\u4e2a\u7b80\u5355\u7684README.md\u00a0\uff0c\u7c7b\u4f3c\u5982\u4e0b\uff1a<\/p>\n

        # Man\r\n \r\nAuthor: @groundwater\r\n \r\n## Install\r\n \r\nnpkg install bin-man\r\n \r\n## Usage\r\n \r\n```\r\nUsage: man PKGNAME\r\n \r\nDisplay a packages README.md file<\/pre>\n

        \u6211\u4eec\u5df2\u7ecf\u57fa\u672c\u5b8c\u6210\u4e86\u6211\u4eec\u7684\u7b2c\u4e00\u4e2a NodeOS \u5b9a\u5236\u5e94\u7528\u3002\u6700\u540e\u5269\u4e0b\u4e00\u5c0f\u6b65\u4e86\uff0c\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e00\u4e2a NodeOS \u5e94\u7528\u9700\u8981\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u5f88\u7b80\u5355\uff0c\u628a\u5b83\u521b\u5efa\u5230\/etc\/bin-man\/config.json\u00a0\uff0c\u5185\u5bb9\u53ea\u662f\u4e00\u4e2a\u7a7a\u7684 JSON \u5bf9\u8c61\uff1a{}\u3002<\/p>\n

        \u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u8bd5\u8bd5\u6211\u4eec\u7684\u65b0\u5e94\u7528\u4e86\uff0c\u5728 NodeOS \u4e2d\u8fd0\u884cman\uff0c\u5b83\u5c06\u5c55\u793a\u6211\u4eec\u4e4b\u524d\u521b\u5efa\u7684 readme \u6587\u4ef6\u3002\u5982\u4f60\u6240\u89c1\uff0c\u5728 NodeOS \u4e2d\u5b9e\u73b0\u4efb\u4f55\u4e1c\u897f\u90fd\u5f88\u7b80\u5355\uff0c\u4f60\u53ea\u9700\u8981\u61c2\u5f97 Node.js \u5373\u53ef\u3002NodeOS \u5f88\u6709\u6f5c\u529b\uff0c\u6211\u8ba4\u4e3a\u5f53\u5b9e\u73b0\u4e86\u66f4\u591a\u7684\u529f\u80fd\u4e4b\u540e\u5b83\u4f1a\u6210\u4e3a\u4e00\u4e2a\u4f1f\u5927\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002\u76ee\u524d\u4ecd\u7136\u9700\u8981\u5f88\u591a\u5de5\u4f5c\uff0c\u4f46\u662f\u5728\u6574\u4e2aNode.js \u751f\u6001\u7cfb\u7edf\u5174\u76db\u53d1\u5c55\u7684\u5f62\u52bf\u4e0b\uff0c\u4e07\u4e00\u54ea\u5929\u5b83\u5f88\u5feb\u5730\u6210\u4e3a\u4e00\u4e2a\u6d41\u884c\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e5f\u6ca1\u4ec0\u4e48\u597d\u60ca\u5947\u7684\u3002<\/p>\n

        \n

        \u539f\u6587\u6765\u81ea\uff1ahttp:\/\/blog.jobbole.com\/97676\/<\/a><\/p>\n

        \u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/nodeos-operating-system.html<\/a>\u7f16\u8f91\uff1a\u51af\u632f\u534e\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

        \u5bfc\u8bfb \u6211\u60f3\u5927\u591a\u6570\u4eba\u542c\u8bf4\u8fc7\u00a0Node.js\uff0c\u4f46\u662f\u4f60\u542c\u8bf4\u8fc7 NodeOS \u5417\uff1f\u4e00\u4e2a\u7528 Node.js \u5199\u7684\u64cd\u4f5c\u7cfb\u7edf […]<\/p>\n","protected":false},"author":309,"featured_media":7437,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-7425","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/7425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/309"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=7425"}],"version-history":[{"count":16,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/7425\/revisions"}],"predecessor-version":[{"id":247188,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/7425\/revisions\/247188"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/7437"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=7425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=7425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=7425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}