随着百度小程序的风头正劲,越来越多的站长投入到百度小程序的开发中来,但是开发过程中难免会碰到诸多问题无法自己解决,2020-12-23小编发现百度用户:【gxchen0802】提出了一个关于“swan-toolkit@3.5.21 安装失败”的问题,在问题中开发者gxchen0802对该问题做了如下阐述:
?mac$ npm i swan-toolkit
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
?
> core-js@2.6.12 postinstall /Users/mac/project/frontpublish/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
?
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
?
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
?
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
?
?
?
> swan-toolkit@3.5.21 postinstall /Users/mac/project/frontpublish/node_modules/swan-toolkit
> node postinstall.js
?
npm
WARN swan-toolkit@3.5.21 No repository field.
npm WARN swan-toolkit@3.5.21 No license field.
?
?
?
+ asar@3.0.3
+ node-darwin-x64@12.16.1
added 64 packages from 62 contributors in 8.747s
?
{ RequestError: Error: read ECONNRESET
? ? at new RequestError (/Users/mac/project/frontpublish/node_modules/request-promise-core/lib/errors.js:14:15)
? ? at Request.plumbing.callback (/Users/mac/project/frontpublish/node_modules/request-promise-core/lib/plumbing.js:87:29)
? ? at Request.RP$callback [as _callback] (/Users/mac/project/frontpublish/node_modules/request-promise-core/lib/plumbing.js:46:31)
? ? at self.callback (/Users/mac/project/frontpublish/node_modules/request/request.js:185:22)
? ? at Request.emit (events.js:198:13)
? ? at Request.onRequestError (/Users/mac/project/frontpublish/node_modules/request/request.js:877:8)
? ? at ClientRequest.emit (events.js:198:13)
? ? at TLSSocket.socketErrorListener (_http_client.js:392:9)
? ? at TLSSocket.emit (events.js:198:13)
? ? at emitErrorNT (internal/streams/destroy.js:91:8)
? name: 'RequestError',
? message: 'Error: read ECONNRESET',
? cause:
?? { Error: read ECONNRESET
?? ? ? at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' },
? error:
?? { Error: read ECONNRESET
?? ? ? at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' },
? options:
?? { url:
? ? ? 'https://smartprogram.baidu.com/mappconsole/api/framework/list',
?? ? qs:
? ? ? { category: '0', host_app: 'baiduboxapp', min_version: '0.0.0' },
?? ? json: true,
?? ? callback: [Function: RP$callback],
?? ? transform: undefined,
?? ? simple: true,
?? ? resolveWithFullResponse: false,
?? ? transform2xxOnly: false },
? response: undefined }
(node:11047) ExperimentalWarning: The fs.promises API is experimental
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! swan-toolkit@3.5.21 postinstall: `node postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the swan-toolkit@3.5.21 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
?
npm ERR! A complete log of this run can be found in:
npm ERR! ? ? /Users/mac/.npm/_logs/2020-12-23T07_05_04_882Z-debug.log
---------------------------------------------------------------------------
我没有使用全局安装,而是在项目内安装的。结果无法安装
注:以上是百度小程序开发者:"gxchen0802"对于本问题的一些阐述,这里做一个引用,我们将实时关注百度小程序助手对该问题提出的解决方案。
【2020-12-24】百度官方对用户gxchen0802提出的swan-toolkit@3.5.21 安装失败给予如下回复
以找到问题,因为安装的时候npm包需要请求地址 https://smartprogram.baidu.com/mappconsole/api/framework/list 额外获取其他的一些包。我们公司服务器有白名单,造成这个请求发送造成安装失败。
百度智能小程序的月活用户超过1.5亿,现在有着40多个流量入口,未来估计能够达到70多个。百度小程序不仅可以运行在百度系列的产品上,像例如爱奇艺、携程等,都是支持百度小程序运行的,这个数量高达40多个。像这样情况,对企业来说,这将意味着接触到更多的用户,百度的小程序的开放申请就又为企业在新移动时代的网络营销多了一个选择和流量阵地。
如果您也在使用百度小程序,请关注我们,如果您有关于百度小程序的使用问题请联系我们,或者去百度小程序平台找官方人员给予解决,相信百度在小程序上的发力会是一个里程碑!