Shw*_*nej 2 magento magento2 progressive-web-apps
我正在本地环境中设置 PWA,并关注https://webkul.com/blog/magento2-3-pwa-studio-setup/this。
运行“yarn run build”命令时,卡在 “BABEL_ENV”处不被识别为内部或外部命令
我已经在全球安装了 babel。
我浏览了很多博客,但找不到解决方案。任何帮助将被appriciated。
$ 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.
Run Code Online (Sandbox Code Playgroud)
他们已经意识到这个问题并正在努力解决它:
https://github.com/magento-research/pwa-studio/pull/899
这是 PWA 工作室package.json脚本的问题。它们是为 Unix 编写的,因为它们依赖于以 Unix 方式设置 env 变量,例如BABEL_ENV=... command.
修复这些脚本的一种方法是使用cross-envpackage 并更改它:
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://www.npmjs.com/package/cross-env#usage
| 归档时间: |
|
| 查看次数: |
2644 次 |
| 最近记录: |