{"id":678,"date":"2026-09-11T14:08:26","date_gmt":"2026-09-11T06:08:26","guid":{"rendered":"https:\/\/fugary.com\/?p=678"},"modified":"2026-09-11T14:08:26","modified_gmt":"2026-09-11T06:08:26","slug":"vue2%e8%80%81%e9%a1%b9%e7%9b%ae%e5%a6%82%e4%bd%95%e8%b7%91%e5%9c%a8%e6%9c%80%e6%96%b0node-js%e4%b8%8a","status":"publish","type":"post","link":"https:\/\/fugary.com\/?p=678","title":{"rendered":"Vue2\u8001\u9879\u76ee\u5982\u4f55\u8dd1\u5728\u6700\u65b0`Node.js`\u4e0a"},"content":{"rendered":"<p>\u6700\u8fd1\u624b\u4e0a\u6709\u4e2a\u8001\u7684<code>vue2<\/code>\u9879\u76ee\uff0c\u4e0d\u8fc7\u9879\u76ee\u6bd4\u8f83\u8001\uff0c\u5b9a\u5236\u63a7\u4ef6\u4e5f\u6bd4\u8f83\u591a\uff0c\u8dd1\u5728<code>Node.js 16<\/code>\u4e0a\u9762\uff0c\u800c\u4e14\u4e5f\u6682\u65f6\u6ca1\u6709\u5347\u7ea7\u53ef\u80fd\u6027\uff0c\u901a\u5e38\u7528<code>nvm<\/code>\u5207\u6362\u7248\u672c\u6216\u8005\u6307\u5b9a<code>node<\/code>\u7248\u672c\u8dd1\uff0c\u4e0d\u5c11\u65b0\u9879\u76ee\u5347\u7ea7\u4e86<code>Node.js<\/code>\u4e86\uff0c\u6d4b\u8bd5\u4ee5\u53ca\u5f00\u53d1\u90fd\u7edf\u4e00\u4f7f\u7528\u65b0\u7684<code>Node.js<\/code>\u4e86\uff0c\u56e0\u6b64\u4ee5\u6700\u7b80\u5355\u7684\u65b9\u5f0f\u6539\u9020\u4e0b\u8001\u7684\u9879\u76ee\uff0c\u53ef\u4ee5\u8dd1\u7740<code>Node.js24<\/code>\u4e0a\u9762\u3002<\/p>\n<h3>\u9519\u8bef\u4fe1\u606f<\/h3>\n<blockquote>\n<p>Building for production...Error: error:0308010C:digital envelope routines::unsupported<br \/>\nat new Hash (node:internal\/crypto\/hash:68:19)<br \/>\nat Object.createHash (node:crypto:138:10)<\/p>\n<\/blockquote>\n<p>\u8fd9\u4e2a\u9519\u8bef\u901a\u5e38\u51fa\u73b0\u5728\u4f7f\u7528 <code>Node.js 17<\/code> \u53ca\u4ee5\u4e0a\u7248\u672c\u65f6\uff0c\u7531\u4e8e <code>OpenSSL 3.x <\/code>\u9ed8\u8ba4\u5b89\u5168\u7b56\u7565\u5bfc\u81f4\u67d0\u4e9b\u52a0\u5bc6\u7b97\u6cd5\u88ab\u7981\u7528\uff0c\u4ece\u800c\u5f15\u53d1\u4e86 \u201cerror:0308010C:digital envelope routines::unsupported\u201d \u7684\u9519\u8bef\u3002<\/p>\n<h3>\u7f16\u5199\u811a\u672c<\/h3>\n<p><code>build.js<\/code>\u6587\u4ef6<\/p>\n<pre><code class=\"language-js\">const { spawn } = require(&#039;child_process&#039;)\n\nconst userArgs = process.argv.slice(2)\nconst action = userArgs.length &gt; 0 ? userArgs.join(&#039; &#039;) : &#039;serve&#039;\nconst baseCommand = `vue-cli-service ${action}`\n\nconst [major] = process.versions.node.split(&#039;.&#039;)\nconst nodeMajor = parseInt(major, 10)\n\nconst env = { ...process.env }\nif (nodeMajor &gt;= 17) {\n  env.NODE_OPTIONS = (env.NODE_OPTIONS ? env.NODE_OPTIONS + &#039; &#039; : &#039;&#039;) + &#039;--openssl-legacy-provider&#039;\n}\n\nconsole.log(`[build.js] \u5f53\u524d Node \u7248\u672c\uff1a${process.versions.node}\uff0c\u6b63\u5728\u6267\u884c\uff1a${baseCommand}`)\n\nconst child = spawn(baseCommand, {\n  shell: true,\n  stdio: &#039;inherit&#039;,\n  env\n})\n\nchild.on(&#039;exit&#039;, (code) =&gt; {\n  process.exit(code || 0)\n})\n\nchild.on(&#039;error&#039;, (err) =&gt; {\n  console.error(`[build.js] \u6267\u884c\u51fa\u9519\uff1a${err.message}`)\n  process.exit(1)\n})<\/code><\/pre>\n<h3>\u914d\u7f6epackage.json<\/h3>\n<pre><code class=\"language-json\">  &quot;scripts&quot;: {\n    &quot;serve&quot;: &quot;node build.js serve&quot;,\n    &quot;build&quot;: &quot;node build.js build&quot;\n  }<\/code><\/pre>\n<p>\u914d\u7f6e\u5b8c\u6210\uff0c\u8fd0\u884c\u548c\u6784\u5efa\u8fd8\u662f\u4f7f\u7528\u539f\u6765\u7684\u547d\u4ee4\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u624b\u4e0a\u6709\u4e2a\u8001\u7684vue2\u9879\u76ee\uff0c\u4e0d\u8fc7\u9879\u76ee\u6bd4\u8f83\u8001\uff0c\u5b9a\u5236\u63a7\u4ef6\u4e5f\u6bd4\u8f83\u591a\uff0c\u8dd1\u5728Node.js 16\u4e0a\u9762\uff0c\u800c\u4e14\u4e5f\u6682\u65f6\u6ca1\u6709\u5347 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[164,165,149],"_links":{"self":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/678"}],"collection":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=678"}],"version-history":[{"count":1,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/678\/revisions"}],"predecessor-version":[{"id":679,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/678\/revisions\/679"}],"wp:attachment":[{"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=678"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=678"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=678"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}