我已经建立了一个基于 Vue 店面的网上商店,我想在 Google 购物上做广告。我想为产品使用 RSS 提要,但不知道如何正确设置它,因为我在根文件夹中"Unexpected token < in JSON at position 0"
运行时得到了它。"yarn feed"
重现问题的步骤
- 1.进入项目文件夹;cd vue-店面
- 2.创建“脚本”文件夹;`mkdir 脚本`
- 3. 进入脚本文件夹;`cd scripts` 并使用此存储库中的代码创建一个新文件;`touch feed.json`
- 4.在`vue-storefront/node_modules`中添加jsontoxml仓库,在这里获取
- 5. 编辑 projectfolder/vue-storefront 中的 package.json 并在 `"scripts"` 部分 `"scripts"` 下添加 "feed": "node scripts/feed.js": {
- 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.