fix: Fix check_translations pre-commit hook failures due to corrupted node_modules#326
Open
fix: Fix check_translations pre-commit hook failures due to corrupted node_modules#326
Conversation
Use npm ci instead of npm install and remove node_modules before installation to ensure a clean state. This prevents errors when npm install is run multiple times or when node_modules is corrupted. Co-authored-by: teolemon <1689815+teolemon@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Investigate and fix translation files issue
Fix check_translations pre-commit hook failures due to corrupted node_modules
Oct 13, 2025
alexgarel
approved these changes
Nov 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
check_translationspre-commit hook was failing in CI with the following error:The root cause was that when
npm installwas run multiple times or encountered filesystem errors during installation, it could leave thenode_modulesdirectory in a corrupted state. This prevented thelit-localizecommand from being properly installed and available in the PATH.The error logs showed numerous
TAR_ENTRY_ERRORmessages andENOENTerrors during npm installation:Solution
Modified the
check_translationstarget in the Makefile to:node_modulesbefore installation usingrm -rf node_modulesto ensure a clean statenpm ciinstead ofnpm installfor cleaner, more reproducible installationsWhy
npm ci?npm ciis designed for CI/CD environments and automated workflowsnode_modulesautomatically and performs a clean installationnpm installfor repeated runspackage-lock.jsonTesting
✅ Verified the command works on clean installations
✅ Tested idempotency (multiple consecutive runs succeed)
✅ Simulated corrupted
node_modulesscenario and confirmed the fix handles it correctly✅ All translation extraction operations complete successfully
This fix ensures the pre-commit hook will work reliably even when run multiple times or when the
node_modulesdirectory is in an inconsistent state.Original prompt
This section details on the original issue you should resolve
<issue_title>Can you investigate and fix this issue ?</issue_title>
<issue_description>### Story
Can you investigate and fix this issue ?
node-checks..............................................................................Passed
Check if translations files in 'frontend/xliff' need to be updated.......................Failed
🔎 Checking translations …
cd frontend && npm install && npm run translations:extract
npm warn deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
npm warn deprecated @babel/plugin-proposal-dynamic-import@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-dynamic-import instead.
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/typescript.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/typescript.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/typescriptServices.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/typescriptServices.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/typesMap.json'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/typingsInstaller.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/watchGuard.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/zh-cn'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/zh-tw'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/loc'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/loc'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/loc'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/loc'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/loc'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/loc'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/loc'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/loc'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/loc'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/home/runner/work/search-a-licious/search-a-licious/frontend/node_modules/@custom-elements-manifest/analyzer/node_modules/typescri...
Fixes #325
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.