Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check file existence before unlinking (vite.buildEnd --> clear) #169

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

rozsazoltan
Copy link
Contributor

Problem

For a while now, I haven't understood why the Vite dev script stopped with an error message indicating an attempt to delete an already deleted language file when called buildEnd function.

node:fs:1876
  binding.unlink(path);
          ^

Error: ENOENT: no such file or directory, unlink 'lang/php_en.json'
    at unlinkSync (node:fs:1876:11)
    at file:///github/secret/node_modules/.pnpm/laravel-vue-i18n@2.7.6_typescript@5.3.3/node_modules/laravel-vue-i18n/dist/vite.mjs:12:33
    at Array.forEach (<anonymous>)
    at process.clean (file:///github/secret/node_modules/.pnpm/laravel-vue-i18n@2.7.6_typescript@5.3.3/node_modules/laravel-vue-i18n/dist/vite.mjs:12:15)
    at process.emit (node:events:531:35)
    at process.exit (node:internal/process/per_thread:192:15)
    at process.<anonymous> (file:///github/secret/node_modules/.pnpm/laravel-vite-plugin@1.0.1_vite@5.1.3/node_modules/laravel-vite-plugin/dist/index.js:127:44)
    at process.emit (node:events:531:35) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'unlink',
  path: 'lang/php_en.json'
}

Node.js v21.5.0

Solution

I see the original idea, and it would be logical that during the clean() function execution, theoretically, every file exists.

However, if not, I'll always encounter an error. I've made a PR to fixed this.

@xiCO2k xiCO2k merged commit fb79248 into xiCO2k:main Feb 23, 2024
1 check passed
@xiCO2k
Copy link
Owner

xiCO2k commented Feb 23, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants