Search code examples
windowssedwindows-10yarnpkggnuwin32

'sed' is not recognized as an internal or external command (Windows 10)


I'm working with a JavaScript app it's running by yarn. I found issue when I run yarn run dev. It's showing below error.

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.

I know it's come from package.json scripts.

"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"
  },

I already download SED from here and install it. Install location C:\Program Files (x86)\GnuWin32. But it's not working. I seen same issue. I don't understand how to fix this issue.

System

OS: Windows 10 Pro.
OS Version: 1909.
OS System Type: 64-bit operating system, x64-based processor.

enter image description here


Solution

  • Did you set the HOME directory as mentioned in here, http://gnuwin32.sourceforge.net/install.html

    If it doesn't fix, install http://cygwin.com/ and give a try