{"id":272388,"date":"2024-05-16T13:15:15","date_gmt":"2024-05-16T05:15:15","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/272388.html"},"modified":"2024-05-16T13:15:26","modified_gmt":"2024-05-16T05:15:26","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8%e5%89%8d%e7%ab%af%e9%a1%b9%e7%9b%ae%e4%b8%ad%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8%e5%8c%85%e7%ae%a1%e7%90%86%e5%99%a8","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/272388.html","title":{"rendered":"\u5982\u4f55\u5728\u524d\u7aef\u9879\u76ee\u4e2d\u5b89\u88c5\u548c\u4f7f\u7528\u5305\u7ba1\u7406\u5668"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24194758\/ddccfc40-75d5-405b-aabe-8008b63e660b.webp\" alt=\"\u5982\u4f55\u5728\u524d\u7aef\u9879\u76ee\u4e2d\u5b89\u88c5\u548c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\" \/><\/p>\n<p><p>\u5305\u7ba1\u7406\u5668\u662f\u524d\u7aef\u5f00\u53d1\u4e2d\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\uff0c<strong>\u7528\u4e8e\u7ba1\u7406\u9879\u76ee\u4e2d\u7684\u4f9d\u8d56\u548c\u6a21\u5757<\/strong>\u3002\u4e3b\u8981\u7684\u5305\u7ba1\u7406\u5668\u5305\u62ecnpm\uff08Node Package Manager\uff09\u3001Yarn\u4ee5\u53capnpm\u7b49\u3002\u5b83\u4eec\u80fd\u591f\u5e2e\u52a9\u5f00\u53d1\u8005\u8f7b\u677e\u5730\u5b89\u88c5\u3001\u66f4\u65b0\u3001\u914d\u7f6e\u548c\u79fb\u9664\u4ee3\u7801\u5e93\u4e2d\u7684\u4f9d\u8d56\u3002\u5728\u8fdb\u884c\u524d\u7aef\u9879\u76ee\u5f00\u53d1\u65f6\uff0c\u9996\u5148\u9700\u8981\u9009\u5b9a\u4e00\u4e2a\u5305\u7ba1\u7406\u5668\uff0c\u7136\u540e\u9075\u5faa\u8be5\u5305\u7ba1\u7406\u5668\u7684\u5b89\u88c5\u6307\u5357\u8fdb\u884c\u5b89\u88c5\u3002\u63a5\u4e0b\u6765\uff0c\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u53ef\u4ee5\u5728\u9879\u76ee\u4e2d\u6267\u884c\u76f8\u5e94\u7684\u547d\u4ee4\u6765\u5b89\u88c5\u6240\u9700\u7684\u5305\uff08package\uff09\u3002\u4f8b\u5982\uff0c\u4f7f\u7528npm\u65f6\uff0c\u4e00\u4e2a\u5178\u578b\u7684\u547d\u4ee4\u662f<code>npm install package-name<\/code>\uff0c\u5b83\u4f1a\u6839\u636e<code>package.json<\/code>\u6587\u4ef6\u7684\u63cf\u8ff0\uff0c\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684\u5305\u53ca\u5176\u4f9d\u8d56\u5230\u9879\u76ee\u4e2d\u7684<code>node_modules<\/code>\u6587\u4ef6\u5939\u3002\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c<code>package.json<\/code>\u548c<code>package-lock.json<\/code>\uff08\u6216\u8005Yarn\u7684<code>yarn.lock<\/code>\uff09\u6587\u4ef6\u5c06\u8ddf\u8e2a\u6240\u6709\u4f9d\u8d56\u7684\u7cbe\u786e\u7248\u672c\uff0c\u786e\u4fdd\u5f00\u53d1\u73af\u5883\u7684\u4e00\u81f4\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u9009\u62e9\u5408\u9002\u7684\u5305\u7ba1\u7406\u5668<\/h3>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u5305\u7ba1\u7406\u5668\u4e4b\u524d\uff0c\u4e86\u89e3\u4e0d\u540c\u7ba1\u7406\u5668\u7684\u7279\u70b9\u548c\u4f18\u52bf\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002<strong>npm<\/strong> \u662fNode.js\u7684\u9ed8\u8ba4\u5305\u7ba1\u7406\u5668\uff0c\u63d0\u4f9b\u4e86\u6781\u5176\u5e9e\u5927\u7684\u8f6f\u4ef6\u5305\u96c6\u5408\u3002<strong>Yarn<\/strong> \u8bde\u751f\u4e8eFacebook\uff0c\u65e8\u5728\u6539\u8fdbnpm\u7684\u6027\u80fd\u548c\u5b89\u5168\u6027\uff0c\u5b83\u5f15\u5165\u4e86\u901f\u5ea6\u66f4\u5feb\u7684\u5b89\u88c5\u8fc7\u7a0b\u4ee5\u53ca\u9501\u6587\u4ef6\u673a\u5236\u3002<strong>pnpm<\/strong> \u66f4\u52a0\u6ce8\u91cd\u6027\u80fd\u548c\u7a7a\u95f4\u5229\u7528\uff0c\u901a\u8fc7\u786c\u94fe\u63a5\u548c\u7b26\u53f7\u94fe\u63a5\u7684\u65b9\u5f0f\u6765\u51cf\u5c11\u78c1\u76d8\u7a7a\u95f4\u7684\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><h4>\u5b89\u88c5\u548c\u914d\u7f6enpm<\/h4>\n<\/p>\n<ol>\n<li>npm\u7684\u5b89\u88c5\u901a\u5e38\u4f34\u968fNode.js\u7684\u5b89\u88c5\u800c\u5b8c\u6210\u3002\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7248\u7684Node.js\uff0cnpm\u5c06\u4f5c\u4e3a\u5176\u7ec4\u4ef6\u4e00\u540c\u88ab\u5b89\u88c5\u3002<\/li>\n<li>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4<code>npm --version<\/code>\u68c0\u67e5npm\u7248\u672c\uff0c\u4fdd\u8bc1\u5176\u5df2\u6b63\u786e\u5b89\u88c5\u3002<\/li>\n<\/ol>\n<p><h4>\u5b89\u88c5\u548c\u914d\u7f6eYarn<\/h4>\n<\/p>\n<ol>\n<li>\u901a\u8fc7npm\u6765\u5168\u5c40\u5b89\u88c5Yarn\uff1a<code>npm install --global yarn<\/code>\u3002<\/li>\n<li>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f7f\u7528<code>yarn --version<\/code>\u6765\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002<\/li>\n<\/ol>\n<p><h4>\u5b89\u88c5\u548c\u914d\u7f6epnpm<\/h4>\n<\/p>\n<ol>\n<li>\u4e0eYarn\u7c7b\u4f3c\uff0c\u53ef\u4ee5\u901a\u8fc7npm\u6765\u5b89\u88c5pnpm\uff1a<code>npm install -g pnpm<\/code>\u3002<\/li>\n<li>\u4f7f\u7528<code>pnpm --version<\/code>\u6765\u786e\u8ba4\u5df2\u7ecf\u6b63\u786e\u5b89\u88c5\u3002<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u521d\u59cb\u5316\u65b0\u7684\u524d\u7aef\u9879\u76ee<\/h3>\n<\/p>\n<p><p>\u5728\u524d\u7aef\u9879\u76ee\u4e2d\u5b89\u88c5\u5305\u7ba1\u7406\u5668\u4e4b\u524d\uff0c\u5e94\u5f53\u9996\u5148\u521d\u59cb\u5316\u9879\u76ee\u3002<strong>\u521d\u59cb\u5316\u9879\u76ee<\/strong> \u5c06\u521b\u5efa\u65b0\u7684<code>package.json<\/code>\u6587\u4ef6\uff0c\u5b83\u662f\u9879\u76ee\u7684\u57fa\u7840\uff0c\u8bb0\u5f55\u4e86\u9879\u76ee\u7684\u5143\u6570\u636e\u548c\u4f9d\u8d56\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h4>\u521b\u5efapackage.json<\/h4>\n<\/p>\n<ol>\n<li>\u4f7f\u7528<code>npm init<\/code>\u6216<code>yarn init<\/code>\u547d\u4ee4\u6839\u636e\u63d0\u793a\u586b\u5199\u9879\u76ee\u4fe1\u606f\uff0c\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u57fa\u672c\u7684<code>package.json<\/code>\u6587\u4ef6\u3002<\/li>\n<li>\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539<code>package.json<\/code>\u6587\u4ef6\u624b\u52a8\u6dfb\u52a0\u6216\u66f4\u65b0\u9879\u76ee\u4fe1\u606f\uff0c\u5982\u9879\u76ee\u7248\u672c\u3001\u4f5c\u8005\u7b49\u3002<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u5b89\u88c5\u4f9d\u8d56<\/h3>\n<\/p>\n<p><p>\u4f9d\u8d56\u662f\u9879\u76ee\u8fd0\u884c\u4e0d\u53ef\u6216\u7f3a\u7684\u7ec4\u4ef6\uff0c\u5305\u62ec\u5e93\u3001\u6846\u67b6\u6216\u5176\u4ed6\u5b9e\u7528\u7a0b\u5e8f\u3002<strong>\u5b89\u88c5\u548c\u7ba1\u7406\u4f9d\u8d56<\/strong> \u662f\u5305\u7ba1\u7406\u5668\u7684\u6838\u5fc3\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h4>\u5b89\u88c5\u9879\u76ee\u4f9d\u8d56<\/h4>\n<\/p>\n<ol>\n<li>\u4f7f\u7528\u5982<code>npm install &lt;package&gt;<\/code>\u3001<code>yarn add &lt;package&gt;<\/code>\u6216<code>pnpm add &lt;package&gt;<\/code>\u547d\u4ee4\u6765\u5b89\u88c5\u9879\u76ee\u4f9d\u8d56\u3002<\/li>\n<li>\u9879\u76ee\u7684\u4f9d\u8d56\u5c06\u88ab\u8bb0\u5f55\u5728<code>package.json<\/code>\u6587\u4ef6\u4e2d\uff0c\u5e76\u4e14\u5b89\u88c5\u7684\u5177\u4f53\u6587\u4ef6\u4f1a\u4f4d\u4e8e<code>node_modules<\/code>\u76ee\u5f55\u3002<\/li>\n<\/ol>\n<p><h4>\u5b89\u88c5\u5f00\u53d1\u4f9d\u8d56<\/h4>\n<\/p>\n<ol>\n<li>\u5f00\u53d1\u4f9d\u8d56\u662f\u4ec5\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u9700\u8981\u7684\u5305\uff0c\u53ef\u4ee5\u4f7f\u7528\u5982<code>npm install &lt;package&gt; --save-dev<\/code>\u3001<code>yarn add &lt;package&gt; --dev<\/code>\u6216<code>pnpm add &lt;package&gt; --save-dev<\/code>\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002<\/li>\n<li>\u8fd9\u4e9b\u4f9d\u8d56\u9879\u5c06\u5728<code>package.json<\/code>\u4e2d\u7684<code>devDependencies<\/code>\u90e8\u5206\u88ab\u8bb0\u5f55\u4e0b\u6765\u3002<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u914d\u7f6e\u9879\u76ee\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u5728<code>package.json<\/code>\u4e2d\u5b9a\u4e49\u9879\u76ee\u811a\u672c\u53ef\u4ee5\u7b80\u5316\u5e38\u89c1\u4efb\u52a1\uff0c\u6bd4\u5982\u7f16\u8bd1\u6e90\u4ee3\u7801\u3001\u542f\u52a8\u5f00\u53d1\u670d\u52a1\u5668\u7b49\u3002<\/p>\n<\/p>\n<p><h4>\u5b9a\u4e49\u811a\u672c\u4efb\u52a1<\/h4>\n<\/p>\n<ol>\n<li>\u5728<code>package.json<\/code>\u7684<code>scripts<\/code>\u5b57\u6bb5\u4e2d\uff0c\u53ef\u4ee5\u5b9a\u4e49\u4e00\u7cfb\u5217\u7684\u811a\u672c\u547d\u4ee4\u3002<\/li>\n<li>\u53ef\u4ee5\u901a\u8fc7<code>npm run<\/code>\u6216<code>yarn run<\/code>\u540e\u8ddf\u811a\u672c\u540d\u6765\u6267\u884c\u8fd9\u4e9b\u811a\u672c\u4efb\u52a1\u3002<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u5305\u7684\u66f4\u65b0\u4e0e\u7ba1\u7406<\/h3>\n<\/p>\n<p><p>\u5305\u7ba1\u7406\u5668\u4e0d\u4ec5\u80fd\u591f\u5b89\u88c5\u4f9d\u8d56\uff0c\u8fd8\u80fd\u5e2e\u52a9\u5f00\u53d1\u8005\u8ddf\u8e2a\u548c\u5347\u7ea7\u8fd9\u4e9b\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><h4>\u66f4\u65b0\u9879\u76ee\u4f9d\u8d56<\/h4>\n<\/p>\n<ol>\n<li>\u4f7f\u7528\u547d\u4ee4\u5982<code>npm update<\/code>\u3001<code>yarn upgrade<\/code>\u6216<code>pnpm update<\/code>\u6765\u66f4\u65b0\u9879\u76ee\u7684\u4f9d\u8d56\u5305\u3002<\/li>\n<li>\u8fd9\u4e9b\u547d\u4ee4\u5c06\u6839\u636e<code>package.json<\/code>\u4e2d\u89c4\u5b9a\u7684\u7248\u672c\u8303\u56f4\uff0c\u4e0b\u8f7d\u5e76\u5b89\u88c5\u53ef\u7528\u7684\u66f4\u65b0\u3002<\/li>\n<\/ol>\n<p><h4>\u7ba1\u7406\u7248\u672c\u63a7\u5236<\/h4>\n<\/p>\n<ol>\n<li><code>package-lock.json<\/code>\uff08npm\uff09\u6216<code>yarn.lock<\/code>\uff08Yarn\uff09\u6587\u4ef6\u8bb0\u5f55\u4e86\u4f9d\u8d56\u7684\u7cbe\u786e\u7248\u672c\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u5f00\u53d1\u4eba\u5458\u548c\u90e8\u7f72\u73af\u5883\u4f7f\u7528\u76f8\u540c\u7684\u4f9d\u8d56\u7248\u672c\u3002<\/li>\n<li>\u9501\u6587\u4ef6\u5e94\u5f53\u4e0e\u9879\u76ee\u4ee3\u7801\u4e00\u540c\u63d0\u4ea4\u5230\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u3002<\/li>\n<\/ol>\n<p><h3>\u516d\u3001\u5904\u7406\u4f9d\u8d56\u5b89\u5168\u548c\u8bb8\u53ef<\/h3>\n<\/p>\n<p><p>\u4fdd\u8bc1\u4f9d\u8d56\u5b89\u5168\u548c\u9075\u5b88\u5f00\u6e90\u8bb8\u53ef\u8bc1\u662f\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u8fc7\u7a0b\u4e2d\u7684\u4e00\u4e2a\u91cd\u8981\u8003\u8651\u70b9\u3002<\/p>\n<\/p>\n<p><h4>\u5ba1\u6838\u4f9d\u8d56\u7684\u5b89\u5168\u6027<\/h4>\n<\/p>\n<ol>\n<li>\u547d\u4ee4\u5982<code>npm audit<\/code>\u6216<code>yarn audit<\/code>\u53ef\u4ee5\u5e2e\u52a9\u68c0\u67e5\u9879\u76ee\u4f9d\u8d56\u4e2d\u7684\u5b89\u5168\u6f0f\u6d1e\uff0c\u5e76\u63d0\u4f9b\u4fee\u590d\u5efa\u8bae\u3002<\/li>\n<li>\u8fd9\u4e9b\u5de5\u5177\u4f1a\u4e0e\u4e00\u4e2a\u6f0f\u6d1e\u6570\u636e\u5e93\u5bf9\u6bd4\uff0c\u6765\u8bc6\u522b\u548c\u62a5\u544a\u6f5c\u5728\u7684\u5b89\u5168\u98ce\u9669\u3002<\/li>\n<\/ol>\n<p><h4>\u9075\u5b88\u8bb8\u53ef\u8bc1\u8981\u6c42<\/h4>\n<\/p>\n<ol>\n<li>\u8bb8\u53ef\u8bc1\u4fe1\u606f\u901a\u5e38\u53ef\u4ee5\u5728\u6bcf\u4e2a\u5305\u7684<code>package.json<\/code>\u4e2d\u627e\u5230\uff0c\u786e\u4fdd\u4f7f\u7528\u7684\u6bcf\u4e2a\u5305\u90fd\u7b26\u5408\u5f00\u6e90\u8bb8\u53ef\u8981\u6c42\u3002<\/li>\n<li>\u53ef\u4ee5\u4f7f\u7528\u5de5\u5177\u5982<code>license-checker<\/code>\u6216<code>yarn licenses<\/code>\u6765\u67e5\u770b\u9879\u76ee\u4f9d\u8d56\u7684\u8bb8\u53ef\u8bc1\u4fe1\u606f\u3002<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u5f00\u53d1\u8005\u80fd\u591f\u5728\u524d\u7aef\u9879\u76ee\u4e2d\u6709\u6548\u5730\u5b89\u88c5\u548c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\uff0c\u4ece\u800c\u7b80\u5316\u4f9d\u8d56\u7ba1\u7406\u8fc7\u7a0b\u3001\u63d0\u9ad8\u751f\u4ea7\u6548\u7387\uff0c\u5e76\u4fdd\u969c\u4ee3\u7801\u5e93\u7684\u7a33\u5b9a\u6027\u4e0e\u5b89\u5168\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<ol>\n<li>\n<p><strong>\u4ec0\u4e48\u662f\u5305\u7ba1\u7406\u5668\uff0c\u4e3a\u4ec0\u4e48\u5728\u524d\u7aef\u9879\u76ee\u4e2d\u9700\u8981\u4f7f\u7528\u5b83\uff1f<\/strong><br \/>\n\u5305\u7ba1\u7406\u5668\u662f\u7528\u6765\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56\u7684\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u8f7b\u677e\u5730\u5b89\u88c5\u3001\u66f4\u65b0\u548c\u7ba1\u7406\u9879\u76ee\u6240\u9700\u7684\u5404\u79cd\u5305\u3001\u5e93\u548c\u5de5\u5177\u3002\u5728\u524d\u7aef\u9879\u76ee\u4e2d\uff0c\u6211\u4eec\u901a\u5e38\u4f1a\u4f7f\u7528\u4e00\u4e9b\u7b2c\u4e09\u65b9\u7684\u5e93\u6216\u8005\u5de5\u5177\u6765\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u529f\u80fd\u6027\uff0c\u800c\u8fd9\u4e9b\u5e93\u6216\u8005\u5de5\u5177\u53c8\u4f9d\u8d56\u4e8e\u5176\u4ed6\u7684\u5305\u3002\u5305\u7ba1\u7406\u5668\u80fd\u591f\u81ea\u52a8\u89e3\u51b3\u5305\u4e4b\u95f4\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u786e\u4fdd\u9879\u76ee\u80fd\u591f\u987a\u5229\u8fd0\u884c\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684\u5305\u7ba1\u7406\u5668\uff1f<\/strong><br \/>\n\u76ee\u524d\u5728\u524d\u7aef\u5f00\u53d1\u4e2d\u6700\u5e38\u7528\u7684\u5305\u7ba1\u7406\u5668\u6709 npm \u548c yarn\u3002npm \u662f Node.js \u7684\u5b98\u65b9\u5305\u7ba1\u7406\u5668\uff0c\u5b83\u62e5\u6709\u5e9e\u5927\u7684\u5f00\u6e90\u793e\u533a\uff0c\u5b89\u88c5\u548c\u4f7f\u7528\u975e\u5e38\u65b9\u4fbf\u3002yarn \u5219\u662f\u7531 Facebook \u5f00\u6e90\u7684\u4e00\u6b3e\u65b0\u4e00\u4ee3\u5305\u7ba1\u7406\u5668\uff0c\u5b83\u5728\u901f\u5ea6\u548c\u7a33\u5b9a\u6027\u4e0a\u76f8\u5bf9\u4e8e npm \u6709\u6240\u63d0\u5347\u3002\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u548c\u559c\u597d\uff0c\u53ef\u4ee5\u9009\u62e9\u9002\u5408\u81ea\u5df1\u7684\u5305\u7ba1\u7406\u5668\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5982\u4f55\u5728\u524d\u7aef\u9879\u76ee\u4e2d\u5b89\u88c5\u548c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\uff1f<\/strong><br \/>\n\u9996\u5148\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86 Node.js \u73af\u5883\uff0c\u56e0\u4e3a npm \u548c yarn \u90fd\u662f\u57fa\u4e8e Node.js \u7684\u3002\u5b89\u88c5 Node.js \u540e\uff0c\u6253\u5f00\u7ec8\u7aef\u6216\u8005\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u8f93\u5165 npm \u6216\u8005 yarn \u7684\u547d\u4ee4\u5c31\u53ef\u4ee5\u67e5\u770b\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002\u5982\u679c\u663e\u793a\u7248\u672c\u53f7\uff0c\u5219\u8868\u793a\u5b89\u88c5\u6210\u529f\u3002<br \/>\n\u63a5\u4e0b\u6765\uff0c\u5728\u4f60\u7684\u524d\u7aef\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u6267\u884c npm init \u6216\u8005 yarn init \u547d\u4ee4\uff0c\u6309\u7167\u63d0\u793a\u8f93\u5165\u9879\u76ee\u7684\u540d\u79f0\u3001\u63cf\u8ff0\u7b49\u4fe1\u606f\uff0c\u5373\u53ef\u751f\u6210\u4e00\u4e2a package.json \u6587\u4ef6\u3002package.json \u6587\u4ef6\u7528\u6765\u8bb0\u5f55\u9879\u76ee\u7684\u4f9d\u8d56\u4fe1\u606f\u3002<br \/>\n\u82e5\u8981\u5b89\u88c5\u4f9d\u8d56\u5305\uff0c\u53ef\u4ee5\u4f7f\u7528 npm install \u6216\u8005 yarn add \u547d\u4ee4\uff0c\u4f8b\u5982\uff1anpm install jquery \u6216\u8005 yarn add react\u3002\u8fd9\u6837\u5c31\u53ef\u4ee5\u5b89\u88c5\u5bf9\u5e94\u7684\u5305\u5230\u9879\u76ee\u4e2d\u4e86\u3002\u53ef\u4ee5\u901a\u8fc7\u5728 package.json \u6587\u4ef6\u4e2d\u624b\u52a8\u66f4\u6539\u4f9d\u8d56\u7684\u7248\u672c\u53f7\uff0c\u7136\u540e\u8fd0\u884c npm install \u6216\u8005 yarn install \u6765\u6279\u91cf\u5b89\u88c5\u6216\u66f4\u65b0\u4f9d\u8d56\u5305\u3002<\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"\u5305\u7ba1\u7406\u5668\u662f\u524d\u7aef\u5f00\u53d1\u4e2d\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\uff0c\u7528\u4e8e\u7ba1\u7406\u9879\u76ee\u4e2d\u7684\u4f9d\u8d56\u548c\u6a21\u5757\u3002\u4e3b\u8981\u7684\u5305\u7ba1\u7406\u5668\u5305\u62ecnpm\uff08Node Packa [&hellip;]","protected":false},"author":3,"featured_media":272401,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/272388"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=272388"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/272388\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/272401"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=272388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=272388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=272388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}