【发布时间】:2020-04-19 21:54:04
【问题描述】:
我正在使用由 yarn 运行的 JavaScript 应用程序。我在运行yarn run dev 时发现了问题。它显示以下错误。
yarn run v1.21.1
$ yarn fixlitepicker && rm -rf .cache/ dist/
$ sed -i 's/# sourceMappingURL/ sourceMappingURL/g' node_modules/litepicker/dist/js/main.js
'sed' 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.
我知道它来自package.json 脚本。
"scripts": {
"dev": "parcel src/index.html",
"build": "yarn install && yarn fixlitepicker && parcel build src/index.html",
"prebuild": "rm -rf dist",
"predev": "yarn fixlitepicker && rm -rf .cache/ dist/",
"fixlitepicker": "sed -i 's/# sourceMappingURL/ sourceMappingURL/g' node_modules/litepicker/dist/js/main.js"
},
我已经从here 下载了SED 并安装了它。安装位置C:\Program Files (x86)\GnuWin32。但它不起作用。我看到了同样的问题。我不明白如何解决这个问题。
系统
操作系统:Windows 10 Pro。
操作系统版本:1909。
操作系统系统类型:64-bit operating system, x64-based processor .
【问题讨论】:
-
显然该脚本是为类 Unix 平台编写的。你能在这里摆脱 Windows 吗? (稍后你会感谢我的。)
-
尝试从 GNU shell 终端环境(v.gr. bash)而不是 Windows 命令行运行 yarn 命令。
-
当我搜索您的主题行的确切文本时,这里还有 22 个其他 Q/A。如果从该搜索中删除
sed is,则有 6000 多个其他 Q/A 处理该主题。您是否查看了这些消息以帮助解决您的问题?请做,祝你好运。
标签: windows sed windows-10 yarnpkg gnuwin32