设置RSS源(谷歌购物)的Vue公司的店面基于网店
我已经建立了一个基于Vue公司的店面的网络商店,我要宣传在谷歌购物。我想使用产品的RSS源和不知道如何正确设置它,因为我的根文件夹运行"Unexpected token < in JSON at position 0"
当越来越"yarn feed"
。
步骤来重现问题
- 1.转到项目文件夹; CD VUE的店面
- 2.创建“脚本”文件夹; `的mkdir scripts`
- 3.进入脚本文件夹; `CD scripts`并使用代码in this repository作出新的文件; `触摸feed.json`
- 4.添加jsontoxml库在`VUE的店面/ node_modules`,得到它here
- 5.在projectfolder / VUE-店面编辑的package.json并添加 “进料”: “节点脚本/ feed.js”,下` “脚本”``节 “脚本”`:{
- 6.`纱feed`
预期结果:
The file was saved!
Done in 0.41s.
实际结果:
$ sudo yarn feed
yarn run v1.12.3
$ node scripts/feed.js
(node:2527) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at
.no/product/_search?size=9000&from=0&sort=&_source_exclude=configurable_children%2Cconfigurable_options%2Csgn&_source_include=type_id%2Csku%2Cproduct_links%2Ctax_class_id%2Cspecial_price%2Cspecial_to_date%2Cspecial_from_date%2Cname%2Cprice%2CpriceInclTax%2CoriginalPriceInclTax%2CoriginalPrice%2CspecialPriceInclTax%2Cid%2Cimage%2Csale%2Cnew%2Curl_key%2Cstatus%2Ctier_prices%2Cdescription
reason: Unexpected token < in JSON at position 0
at /opt/bitnami/apps/hoversport.no/vue-storefront/node_modules/node-fetch/lib/body.js:48:31
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:2527) UnhandledPromiseRejectionWarning: Unhandled promise rejection.
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2527) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 0.35s.
回答如下:
这似乎是VUE的店面-API不响应或错误响应
https://hoversport.no/api/catalog/hoversport.no/product/_search?size=9000&from=0&sort=&_source_exclude=configurable_children%2Cconfigurable_options%2Csgn&_source_include=type_id%2Csku%2Cproduct_links%2Ctax_class_id%2Cspecial_price%2Cspecial_to_date%2Cspecial_from_date%2Cname%2Cprice%2CpriceInclTax%2CoriginalPriceInclTax%2CoriginalPrice%2CspecialPriceInclTax%2Cid%2Cimage%2Csale%2Cnew%2Curl_key%2Cstatus%2Ctier_prices%2Cdescription
reason: Unexpected token < in JSON at position 0
我得到这个错误:
好像是没有弹性的搜索进行索引命名hoversport.no
(可能是它?vue_storefront_catalog
)