我正在本地环境中建立PWA,并遵循https://webkul.com/blog/magento2-3-pwa-studio-setup/。
卡住在'BABEL_ENV‘不被识别为内部或外部命令时运行“纱线运行生成”命令
我在全球范围内安装了babel。
我已经浏览了很多博客,但没有找到解决方案。任何帮助都是徒劳无功。
$ yarn run build
yarn run v1.15.2
$ yarn workspaces run build
$ echo 'Skipping graphql-cli-validate-magento-pwa-queries build...'
'Skipping graphql-cli-validate-magento-pwa-queries build...'
$ concurrently --raw yarn:build:cjs yarn:build:esm
$ BABEL_ENV=production babel src --out-dir dist --root-mode 'upward' --source-maps
$ BABEL_ENV=development babel src --out-dir esm --root-mode 'upward' --source-maps
'BABEL_ENV' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: C:\Program Files\nodejs\node.exe
Arguments: C:\Program Files (x86)\Yarn\lib\cli.js build
Directory: D:\wamp\www\mage-pwa\pwa-studio\packages\peregrine
Output:
info Visit https://yarnpkg.com/en/docs/cli/workspaces for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.发布于 2019-04-12 10:34:22
他们意识到这一问题,目前正在努力解决这个问题:
https://github.com/magento-research/pwa-studio/pull/899
这是PWA工作室package.json脚本的问题所在。它们是为Unix编写的,因为它们依赖于以Unix方式设置env变量,例如BABEL_ENV=... command。
修复这些脚本的一种方法是使用cross-env包并更改以下内容:
BABEL_ENV=production babel src --out-dir dist --root-mode 'upward' --source-maps
对此:
cross-env BABEL_ENV=production babel src --out-dir dist --root-mode 'upward' --source-maps
在这里查看cross-env文档:
https://stackoverflow.com/questions/55495155
复制相似问题