how to debug exception in compile process?
See original GitHub issueThere is command line history:
landsman@X230:~/projects/company/web$ npm run extract
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/2369/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> company-web@1.0.0 extract /home/landsman/projects/company/web
> lingui extract
Catalog statistics:
ββββββββββββ¬ββββββββββββββ¬ββββββββββ
β Language β Total count β Missing β
ββββββββββββΌββββββββββββββΌββββββββββ€
β cs β 219 β 205 β
β en β 215 β 116 β
ββββββββββββ΄ββββββββββββββ΄ββββββββββ
(use "npm run add-locale <locale>" to add more locales)
(use "npm run extract" to update catalogs with new messages)
(use "npm run compile" to compile catalogs for production)
landsman@X230:~/projects/company/web$ npm run compile
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/2369/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> company-web@1.0.0 compile /home/landsman/projects/company/web
> lingui compile
Compiling message catalogsβ¦
/home/landsman/projects/company/web/node_modules/@lingui/cli/api/catalog.js:131
return catalogs[locale][key].translation;
^
TypeError: Cannot read property 'translation' of undefined
at getTranslation (/home/landsman/projects/company/web/node_modules/@lingui/cli/api/catalog.js:131:38)
at Object.getTranslation (/home/landsman/projects/company/web/node_modules/@lingui/cli/api/catalog.js:138:27)
at /home/landsman/projects/company/web/node_modules/@lingui/cli/lingui-compile.js:82:61
at Array.map (<anonymous>)
at /home/landsman/projects/company/web/node_modules/@lingui/cli/lingui-compile.js:81:83
at Array.map (<anonymous>)
at command (/home/landsman/projects/company/web/node_modules/@lingui/cli/lingui-compile.js:70:18)
at Object.<anonymous> (/home/landsman/projects/company/web/node_modules/@lingui/cli/lingui-compile.js:142:17)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! company-web@1.0.0 compile: `lingui compile`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the company-web@1.0.0 compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/landsman/.npm/_logs/2019-07-19T14_47_47_850Z-debug.log
And log:
0 info it worked if it ends with ok
1 verbose cli [ '/snap/node/2369/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'compile' ]
2 info using npm@6.10.1
3 info using node@v10.16.0
4 verbose run-script [ 'precompile', 'compile', 'postcompile' ]
5 info lifecycle company-web@1.0.0~precompile: company-web@1.0.0
6 info lifecycle company-web@1.0.0~compile: company-web@1.0.0
7 warn lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/2369/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
8 verbose lifecycle company-web@1.0.0~compile: unsafe-perm in lifecycle true
9 verbose lifecycle company-web@1.0.0~compile: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/landsman/projects/company/web/node_modules/.bin:/home/landsman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
10 verbose lifecycle company-web@1.0.0~compile: CWD: /home/landsman/projects/company/web
11 silly lifecycle company-web@1.0.0~compile: Args: [ '-c', 'lingui compile' ]
12 silly lifecycle company-web@1.0.0~compile: Returned: code: 1 signal: null
13 info lifecycle company-web@1.0.0~compile: Failed to exec compile script
14 verbose stack Error: company-web@1.0.0 compile: `lingui compile`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
14 verbose stack at EventEmitter.emit (events.js:198:13)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
14 verbose stack at ChildProcess.emit (events.js:198:13)
14 verbose stack at maybeClose (internal/child_process.js:982:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
15 verbose pkgid company-web@1.0.0
16 verbose cwd /home/landsman/projects/company/web
17 verbose Linux 4.15.0-54-generic
18 verbose argv "/snap/node/2369/bin/node" "/usr/local/bin/npm" "run" "compile"
19 verbose node v10.16.0
20 verbose npm v6.10.1
21 error code ELIFECYCLE
22 error errno 1
23 error company-web@1.0.0 compile: `lingui compile`
23 error Exit status 1
24 error Failed at the company-web@1.0.0 compile script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
There must be a problem with some key in locales file, but I donβt know how to degug it.
Implementation is good, it worked before few changes in locale files.
Can you please provide me some steps how to debug this process? Is there some better way how to find bad row in my locales file?
Thanks
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Compilation and Debugging - Computer Science, FSU
Always start at the top of the list of errors. Fix the first error, then recompile and see what is left. If a...
Read more >Manage exceptions with the debugger in Visual Studio
In the Exception Settings window (Debug > Windows > Exception Settings), expand the node for a category of exceptions, such as Common LanguageΒ ......
Read more >Compiler Reference - Error checking and debugging - IBM
Previews the compilation steps specified on the command line, ... Determines what types of floating-point exception conditions to detect at run time.
Read more >Chapter 7: Exception Handling and Debugging
After you have found an exception, or preferably before your software is distributed, you should go through the code and debug it in...
Read more >4. Error Handling and Debugging - VBScript in a Nutshell [Book]
Ordinarily, objects containing script are compiled as they are loaded, and are then immediately executed. Errors can occur at either stage of the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So, I debugged that.
There was problem with commented translate which was only in one of two locales. I probably deleted this obsolete translate from one of locale and forgott it in second one.
Next problem was that this key was translated directly in
msgid
not inmsgstr
. Thanks this lingui searched this key in original language - moment of exception.merged here https://github.com/lingui/js-lingui/commit/223ced9619522f5deff38ebbc25ccdeae12ef9e0