You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: ENOENT: no such file or directory, lstat 'XYZ'
at Object.lstatSync (fs.js:845:3)
at replaceFileSync (/home/develop/repos/node_modules/replace-x/dist/replace-x.js:217:31)
at Array.forEach ()
at replace (/home/develop/repos/node_modules/replace-x/dist/replace-x.js:266:14)
at Object. (/home/develop/repos/node_modules/replace-x/bin/replace-x.js:42:1)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
The text was updated successfully, but these errors were encountered:
I'm able to reproduce this. It looks like the script is taking the replacement string as one of the paths to look for files:
$ npm i replace-x
$ npx replace-x --version
1.7.2
$ echo'this file has text'> test.txt
$ cat test.txt
this file has text
$ npx replace-x 'text''TEXT BUT UPPERCASE' test.txt
ENOENT: no such file or directory, lstat 'TEXT BUT UPPERCASE'
I was able to fix it by adding the replacement property to shared-options:
replacement: {position: 1,// Second argumentstring: true,describe: 'Replacement string for matches',demandOption: true,}
At the same time, the paths property has a wrong index of 1 when it should be 2 (third argument):
After those fixes, I was able to run the script successfully:
$ echo'some random TEXT'> test.txt
$ cat test.txt
some random TEXT
$ npx replace-x 'TEXT''text, but lowercase' test.txt
test.txt
1: some random text, but lowercase
$ cat test.txt
some random text, but lowercase
in package json build command:
"ng-build": ng build --configuration=qa --project="app-web" --base-href=./ && replace-x 'ABC' 'XYZ' dist/app/index.html",
Error
fs.js:114
throw err;
^
Error: ENOENT: no such file or directory, lstat 'XYZ'
at Object.lstatSync (fs.js:845:3)
at replaceFileSync (/home/develop/repos/node_modules/replace-x/dist/replace-x.js:217:31)
at Array.forEach ()
at replace (/home/develop/repos/node_modules/replace-x/dist/replace-x.js:266:14)
at Object. (/home/develop/repos/node_modules/replace-x/bin/replace-x.js:42:1)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
The text was updated successfully, but these errors were encountered: