gpt4 book ai didi

magento - “BABEL_ENV”未被识别为内部或外部命令

转载 作者:行者123 更新时间:2023-12-05 09:13:42 25 4
gpt4 key购买 nike

我正在本地环境中设置 PWA,并遵循 https://webkul.com/blog/magento2-3-pwa-studio-setup/这个。

在运行"yarn run build" 命令时卡在'BABEL_ENV' is not recognized as an internal or external command

我已经全局安装了 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.

最佳答案

他们已经意识到这个问题并正在努力修复它:

https://github.com/magento-research/pwa-studio/pull/899

这是 PWA studio package.json 脚本的问题。它们是为 Unix 编写的,因为它们依赖于以 Unix 方式设置环境变量,例如BABEL_ENV=...命令

修复这些脚本的一种方法是使用 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://www.npmjs.com/package/cross-env#usage

关于magento - “BABEL_ENV”未被识别为内部或外部命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55495155/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com