javascript - 为基于Vue店面的网上商店设置RSS Feed(Google购物)

标签 javascript node.js vue.js rss vue-storefront

我已经建立了一个基于Vue店面的网上商店,我想在此在Google购物上做广告。我想对产品使用RSS feed,并且不确定在根文件夹中运行"Unexpected token < in JSON at position 0"时是否得到"yarn feed"时如何正确设置它。

重现问题的步骤


1.转到项目文件夹; cd vue店面
2.创建“脚本”文件夹; `mkdir脚本`
3.转到脚本文件夹; cd脚本并使用代码in this repository制作一个新文件;触摸feed.json
4.在“ vue-storefront / node_modules”中添加jsontoxml存储库,将其获取为here
5.在projectfolder / vue-storefront中编辑package.json并添加
“ feed”:“ node scripts / feed.js”,在“” scripts“`部分”“ scripts”`下:{
6.“喂纱”


预期结果:

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     
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
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-storefront-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的Elastic Search(可能是它的vue_storefront_catalog吗?)

关于javascript - 为基于Vue店面的网上商店设置RSS Feed(Google购物),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53869640/

相关文章:

javascript - Spotify (Javascript) 中的 ajax 调用后未保存 Cookie?

javascript - 以编程方式创建 <DIV> 并出现问题

node.js - Node.js 中的路径令人困惑

javascript - Electron中父子窗口之间如何发送数据

webpack - 如何使用 webpack 导入 min 文件

javascript - 获取iframe的内容

Javascript:无法分配给 false 的只读属性 '_epoch'

javascript - 为什么 Node.js 中非交互式 Function 对象内的上下文不同?

javascript - Vue.js:导入带有函数的类并在子组件中调用它

javascript - 我无法在 javascript 函数中调用 mixin 函数