Open jacobjove opened 1 year ago
Perhaps vue-template-compiler
should be made an optional dependency?
@iacobfred seems like problem in vue-template-compiler - it's trying to resolve 'vue' dependency, in case it was found in node_modules of your project it's trying to check if version of vue if compatible with current version of vue-template-compiler (which is 2.7.14 in context of lates i18next-parser). I assume if you'll run npm ls vue
you will notice that vue somehow us used in your project(as parent dependency), that is why you are getting this weird error.
There is two potential solution:
Check version vue-template-compiler(npm ls vue-template-compiler
) and install the same version of vue as dev dependency(npm i -D vue@<need-version>
). Thus here will be resolved correct version of vue(from top level dependencies)
before running any cli command or scripts related to n18next-parse, run this script
const fs = require('fs');
const vueTemplateCompilerIndex = fs.readFileSync(
'node_modules/vue-template-compiler/index.js',
'utf-8',
);
// replace with some fake package
const fixedVueTemplateCompilerIndex = vueTemplateCompilerIndex.replace(
"require('vue').version",
"require('vue2').version",
);
if (fixedVueTemplateCompilerIndex === vueTemplateCompilerIndex) {
return process.exit(0);
}
fs.writeFileSync('node_modules/vue-template-compiler/index.js', fixedVueTemplateCompilerIndex, {
flag: 'w',
});
Thus verification of vue and vue-template-compiler versions will be ignored
NOTE!
This solutions are valid only in case you are sure that vue is not used somehow, like in your case or in case your are using i18next, i18next-parser for BE projects only
It's pretty sad, that there's no proper fix for this...
In our monorepo another project uses vue version 3, so in conclusion this package is useless for us?
When I tried to run the cli, I got the following error:
I'm not using Vue templates (I'm using JSX in a Next.js project), so I don't think it should be necessary for me to install any version of vue-template-compiler...