'vue)'' is not recognized as an internal or external command
m4ss1m0g opened this issue · comments
System
- vuecli 4.1.2
- yarn 1.21.1
- OS Windows 10
Steps to reproduce
-
vue create -d -n repro
-
cd repro
-
vue add i18n
-
Setup with
- locale: en,
- fallback: en,
- localization directory: locales,
- enable locale on single file component: yes
-
yarn run i18n:report
Expected behavior
Scan files and report missing / unused localization
Actual Behavior
$ vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json' 'vue)'' is not recognized as an internal or external command, operable program or batch file. error Command failed with exit code 255. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Having the same problem. An Attempt to replace the single quotes with escaped double quotes did also not work
Having the same problem. An Attempt to replace the single quotes with escaped double quotes did also not work
Yes, that is the trick:
"vue-cli-service i18n:report --src \"./src/**/*.?(js|vue)\" --locales \"./src/locales/**/*.json\""
Having the same problem. An Attempt to replace the single quotes with escaped double quotes did also not work
Yes, that is the trick:
"vue-cli-service i18n:report --src \"./src/**/*.?(js|vue)\" --locales \"./src/locales/**/*.json\""
Only works for me when running from the console (cmd, Powershell, GIT Bash) but not when running from Vue UI web interface. There I get the following error:
$ vue-cli-service i18n:report --src ./src/**/*.?(js|vue)" --locales "./src/locales/**/*.json 'vue)" --locales ".' is not recognized as an internal or external command, operable program or batch file.
Only works for me when running from the console (cmd, Powershell, GIT Bash) but not when running from Vue UI web interface.
I have written a small .js wrapping the command.
i18n.js
/* eslint-disable @typescript-eslint/no-var-requires */
const { exec } = require("child_process");
const cmd =
'npx vue-cli-service i18n:report --src "./src/**/*.?(vue)" --locales "./src/locales/**/*.json"';
exec(cmd, (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`${stdout}`);
});
And on package.json
"scripts": {
"i18n:report": "node i18n.js"
},
I solved this issue on Windows 10 as follows:
- Replace the single quotes by escaped double quotes.
- Replace
*.?(js|vue)
by*.{js,vue}
(i.e. curly-braces without leading question-mark).
# package.json
- "i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'"
+ "i18n:report": "vue-cli-service i18n:report --src \"./src/**/*.{js,vue}\" --locales \"./src/locales/**/*.json\""
PS: It looks like (1) is sufficient, see this comment in #49.