question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Path with double context in windows for --add option

See original GitHub issue

I think I found a bug.

When I launch :

npx vue-i18n-extract report -v "./src/**/*.?(vue)" -l "./src/locales/**/*.json" -a

I got this result :

ectory, open 'C:\repoC:\repo\src\locales\en.json'
    at Object.openSync (fs.js:462:3)
    at Object.writeFileSync (fs.js:1384:35)
    at C:\laragon\www\oklinda\node_modules\vue-i18n-extract\dist\vue-i18n-extrac
t.umd.js:189:12

Here is the fix I did : In vue-i18n-extract.umd.js line 185

function writeMissingToLanguage(resolvedLanguageFiles, missingKeys) {
    const languageFiles = readLangFiles(resolvedLanguageFiles);
   [...]
      const fileExtension = languageFile.fileName.substring(languageFile.fileName.lastIndexOf('.') + 1);
      const filePath = path.resolve(process.cwd() + languageFile.fileName);
      const stringifiedContent = JSON.stringify(languageFileContent, null, 2);

     [...}
    });
  }

Remove the process.cwd() as the path are already in the context.

function writeMissingToLanguage(resolvedLanguageFiles, missingKeys) {
    const languageFiles = readLangFiles(resolvedLanguageFiles);
   [...]
      const fileExtension = languageFile.fileName.substring(languageFile.fileName.lastIndexOf('.') + 1);
      const filePath = path.resolve(languageFile.fileName);
      const stringifiedContent = JSON.stringify(languageFileContent, null, 2);

     [...}
    });
  }

Now it works for me.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

2reactions
esfranercommented, Jan 21, 2021

The problem only appears if you run it on Windows, it works perfectly on Linux.

Hum interesting, clearly the process.cwd() don’t have the same behavior in Windows and in Linux then.

Can you try my fix in linux too, just to see if it broke it or not?

Thanks for the update. 😃

If I try to do it in linux I find the following error: image

1reaction
gilles-crealpcommented, Jan 28, 2021

It’s a typo; you must use , with path.resolve not +

It has been solved in #94, update to version 1.1.11.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add "Add To Path" To Context Menu - Itechtics
In this article the method of adding path to context menu will be ... then double click AddPathEntries.reg and accept the window prompt...
Read more >
Add "Add to Path" to context menu - windows 10 - Super User
Since setx sets the user path and not the system path, the command mentioned in my question will add all elements in the...
Read more >
adding a shell context menu item so that I can add folder to ...
I just spent the last 6+ hours of my life trying to be able to add a directory to my path (permanently) from...
Read more >
Add Or Remove Any Folder To PATH Variable Using Windows ...
Ever wished you could just right-click a folder and have the option in the context menu to add it to the PATH variable?...
Read more >
Migrations with Multiple Providers - EF Core - Microsoft Learn
One way to create multiple migration sets is to use one DbContext type per provider. ... Specify the context type when adding new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found