首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“BABEL_ENV”不被识别为内部或外部命令

“BABEL_ENV”不被识别为内部或外部命令
EN

Stack Overflow用户
提问于 2019-04-03 12:25:08
回答 1查看 3.7K关注 0票数 2

我正在本地环境中建立PWA,并遵循https://webkul.com/blog/magento2-3-pwa-studio-setup/

卡住在'BABEL_ENV‘不被识别为内部或外部命令时运行“纱线运行生成”命令

我在全球范围内安装了babel。

我已经浏览了很多博客,但没有找到解决方案。任何帮助都是徒劳无功。

代码语言:javascript
复制
$ 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.
EN

回答 1

Stack Overflow用户

发布于 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://www.npmjs.com/package/cross-env#usage

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55495155

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档