首页 > 解决方案 > shopware-pwa 初始化中的安装错误

问题描述

我正在尝试安装shopware-pwa. 我正在按照中的步骤https://github.com/vuestorefront/shopware-pwa

但是在初始化项目的第一步npx @shopware-pwa/cli init

安装时我使用了默认选项:

* Shopware instance address: · https://shopware6-demo.vuestorefront.io
* Shopware instance access token: · SWSCVJJET0RQAXFNBMTDZTV1OQ
* Which version you'd like to use: latest stable (recommended)

Error: Command failed: npx --ignore-existing create-nuxt-app@3.2.0 --answers "{\"name\":\"shopware-pwa-project\",\"description\":\"shopware-pwa-project description\",\"author\":\"Vue Storefront\",\"pm\":\"yarn\",\"ui\":\"none\",\"language\":\"js\",\"server\":\"none\",\"features\":[\"axios\",\"pwa\"],\"linter\":[\"prettier\",\"lintStaged\"],\"test\":\"jest\",\"mode\":\"universal\",\"target\":\"server\",\"devTools\":[],\"gitUsername\":\"\",\"ci\":\"none\"}"
npx: the --ignore-existing argument has been removed.
See `npm help exec` for more information
Trace: Error: Answers JSON could not be parsed (Unexpected token n in JSON at position 1)
    at SAO.runGenerator (/home/user/.npm/_npx/059d932392171cf4/node_modules/sao/lib/index.js:126:15)
    at SAO.run (/home/user/.npm/_npx/059d932392171cf4/node_modules/sao/lib/index.js:101:16)
    at /home/user/.npm/_npx/059d932392171cf4/node_modules/create-nuxt-app/lib/cli.js:51:17

有人提出这个问题吗?

标签: progressive-web-appsshopware

解决方案


我在 create-nuxt-app GitHub 存储库中发现了问题 #612 。似乎在 --answers 参数之后,您必须以单引号 (') 开头,然后将配置粘贴为 JSON。JSON 不得包含任何换行符/回车符,并且属性之间不得有任何空格 ( )。

因此,在您的情况下,您的 bash 命令应如下所示:

npx --ignore-existing create-nuxt-app@3.2.0 --answers '{"name":"shopware-pwa-project","description":"shopware-pwa-project description","author":"Vue Storefront","pm":"yarn","ui":"none","language":"js","server":"none","features":["axios","pwa"],"linter":["prettier","lintStaged"],"test":"jest","mode":"universal","target":"server","devTools":[],"gitUsername":"","ci":"none"}'

我刚刚在我的机器上尝试过它并且它有效。我只收到警告,因为该--ignore-existing论点已被删除。希望这能解决您的问题!

问候


推荐阅读