Search code examples
windowsyarnpkg

Can't pass options to "DEL" from package.json script


Windows 11, Yarn 3.2.4

My package.json has this

  "scripts": {
    "predist": "del /Q \"WWW\\*\"",

Trying to run it gives this:

PS C:\MyProject> yarn predist
Could Not Find C:\/Q
C:\MyProject\WWW\*, Are you sure (Y/N)?

If I omit the /Q files are deleted as expected once I answer the confirmation prompt

How to stop the /Q being interpreted as a filename?


Solution

  • rimraf solves this completely. https://www.npmjs.com/package/rimraf

    > yarn add --dev rimraf
    
    "predist": "rimraf WWW/*",