adamreisnz / replace-in-file

A simple utility to quickly replace contents in one or more files
580 stars 65 forks source link

Using callbacks for `to` throws error #130

Closed XmlmXmlmX closed 3 years ago

XmlmXmlmX commented 4 years ago

When I try the example from here, the following error will be thrown:

Error: Must specify string or regex to replace
    at parseConfig (.\node_modules\replace-in-file\lib\helpers\parse-config.js:41:11)
    at combineConfig (.\node_modules\replace-in-file\lib\helpers\combine-config.js:56:10)
    at main (.\node_modules\replace-in-file\bin\cli.js:29:19)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
adamreisnz commented 3 years ago

That error gets thrown when from is undefined:

image

The to parameter is the one with the callback.

Can you show me your code that you used to generate this error?

adamreisnz commented 3 years ago

Since this is quite old I will go ahead and close this off, but feel free to reopen if you are still having issues.