{"id":4130,"date":"2019-04-19T13:22:47","date_gmt":"2019-04-19T05:22:47","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=4130"},"modified":"2019-04-19T13:22:47","modified_gmt":"2019-04-19T05:22:47","slug":"%e8%a7%a3%e5%86%b3-error-cannot-find-module-wx-server-sdk-%e5%bc%82%e5%b8%b8%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=4130","title":{"rendered":"\u89e3\u51b3 Error: Cannot find module &#8216;wx-server-sdk&#8217; \u5f02\u5e38\u95ee\u9898"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5176\u5b9e\u4e5f\u662f\u86ee\u6709\u610f\u601d\u7684\u3002\u6700\u8fd1\u6211\u5728\u5199 demo \u7684\u8fc7\u7a0b\u4e2d\u4e5f\u9047\u5230\u4e86\u4e0d\u5c11\u7684\u9519\uff0c\u4f46\u662f\u7f51\u4e0a\u7684\u8d44\u6599\u8fd8\u662f\u633a\u5c11\u7684\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u65b9\u9762\u53ef\u80fd\u662f\u6211\u7684\u8fd9\u4e2a\u9519\u8bef\u4e0d\u5e38\u89c1\uff0c\u8fd8\u6709\u7684\u53ef\u80fd\u5c31\u662f\u6211\u7684\u73af\u5883\u95ee\u9898\u3002\u8fd9\u4e0d\uff0c\u4eca\u5929\u53c8\u9047\u5230\u4e86\u4e00\u4e2a\u9519\u8bef\uff1aError: Cannot find module &#8216;wx-server-sdk&#8217;\u3002\u5b8c\u6574\u9519\u8bef\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Error: Cannot find module &#8216;wx-server-sdk&#8217; at Function.Module._resolveFilename<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">upload score failed Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail cloud function service error code -504002, error message Cannot find module &#8216;wx-server-sdk&#8217;; at cloud.callFunction api;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1g27vhi0banj20fv05uwhq.jpg\" alt=\"\" \/><figcaption>Error: Cannot find module &#8216;wx-server-sdk&#8217;<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6839\u636e\u9519\u8bef\u63d0\u793a\uff0c\u597d\u50cf\u662f\u8bf4 wx-server-sdk \u8fd9\u4e2a\u6a21\u5757\uff0c\u6ca1\u6709\u627e\u5230\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u4e3a\u5728\u8fdb\u884c\u4e91\u51fd\u6570\u5f00\u53d1\u7684\u65f6\u5019\uff0c\u9996\u5148\u5c31\u56de\u5f15\u7528 const cloud = require(&#8216;wx-server-sdk&#8217;)\u3002\u4e91\u73af\u5883\u80af\u5b9a\u662f\u6709\u8fd9\u4e2a\u6a21\u5757\u7684\uff0c\u95ee\u9898\u662f\u6211\u4eec\u7684\u672c\u5730\u8c03\u8bd5\u73af\u5883\u8fd8\u6ca1\u6709\u8fd9\u4e2a\u6a21\u5757\u3002\u6240\u4ee5\uff0c\u6211\u4eec\u9700\u8981\u5148\u5b89\u88c5\u8fd9\u4e2a\u6a21\u5757\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b89\u88c5\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u5373\u53ef\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install --save wx-server-sdk@latest<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u5982\u679c\u9047\u5230\u9519\u8bef\uff0c\u53ef\u4ee5\u770b\u6211\u7684\u4e0a\u4e00\u7bc7\u6587\u7ae0\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1g27vfulgrsj20fs08dt9s.jpg\" alt=\"\" \/><figcaption>npm install &#8211;save wx-server-sdk@latest<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u518d\u8fdb\u884c\u672c\u5730\u8c03\u8bd5\u5c31\u4f1a\u4e00\u5e06\u98ce\u987a\u4e86\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=4130\">\u89e3\u51b3 Error: Cannot find module &#8216;wx-server-sdk&#8217; \u5f02\u5e38\u95ee\u9898<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5176\u5b9e\u4e5f\u662f\u86ee\u6709\u610f\u601d\u7684\u3002\u6700\u8fd1\u6211\u5728\u5199 demo \u7684\u8fc7\u7a0b\u4e2d\u4e5f\u9047\u5230\u4e86\u4e0d\u5c11\u7684\u9519\uff0c\u4f46\u662f\u7f51\u4e0a\u7684\u8d44\u6599\u8fd8\u662f\u633a\u5c11\u7684\u3002  [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[558,1588,446,444,1432],"class_list":["post-4130","post","type-post","status-publish","format-standard","hentry","category-html5","tag-558","tag-1588","tag-js-sdk","tag-444","tag-1432"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4130"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4130\/revisions"}],"predecessor-version":[{"id":4131,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4130\/revisions\/4131"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}