首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >“‘sed”不能识别为内部或外部命令(Windows 10)

“‘sed”不能识别为内部或外部命令(Windows 10)
EN

Stack Overflow用户
提问于 2019-12-31 10:33:52
回答 2查看 16.9K关注 0票数 2

我正在使用JavaScript应用程序,它是由yarn运行的。我在运行yarn run dev时发现了问题。它显示在错误下面。

代码语言:javascript
运行
复制
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脚本。

代码语言:javascript
运行
复制
"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"
  },

我已经从SED下载这里并安装它。安装位置C:\Program Files (x86)\GnuWin32。但这不管用。我也看到了同样的问题。我不明白如何解决这个问题。

系统

OSWindows 10 Pro

OS版本1909

OS系统类型64-bit operating system, x64-based processor

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-12-31 10:39:30

您是否设置了这里提到的主目录,http://gnuwin32.sourceforge.net/install.html

如果没有修复,安装http://cygwin.com/并试一试

票数 1
EN

Stack Overflow用户

发布于 2020-12-19 17:30:13

您从GnuWin32下载并安装了‘sed’,但它不在您的路径上。您需要在将C:\Program Files (x86)\GnuWin32添加到PATH的终端中运行。您还可以从安装“哪个”中获益,然后可以使用which sed进行正常检查。

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

https://stackoverflow.com/questions/59542909

复制
相关文章

相似问题

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