Skip to main content

Angular i18n issue - Cannot read property 'toLowerCase' of null

After following the steps in the Angular documentation to setup internationalization(i18n) support, I tried to execute my brand new i18n npm command:

PS C:\Projects\test\AngularLocalization\angularlocal> npm run i18n

> angularlocal@0.0.0 i18n C:\Projects\test\AngularLocalization\angularlocal

> ng-xi18n

TypeError: Cannot read property 'toLowerCase' of null

    at Extractor.serialize (C:\Projects\test\AngularLocalization\angularlocal\node_modules\@an

gular\compiler-cli\src\extractor.js:47:32)

    at C:\Projects\test\AngularLocalization\angularlocal\node_modules\@angular\compiler-cli\sr

c\extractor.js:33:33

    at process._tickCallback (internal/process/next_tick.js:109:7)

    at Module.runMain (module.js:606:11)

at run (bootstrap_node.js:389:7)

    at startup (bootstrap_node.js:149:9)

    at bootstrap_node.js:502:3

Extraction failed

npm ERR! Windows_NT 10.0.15063

npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\

npm\\bin\\npm-cli.js" "run" "i18n"

npm ERR! node v6.11.3

npm ERR! npm  v3.10.10

npm ERR! code ELIFECYCLE

npm ERR! angularlocal@0.0.0 i18n: `ng-xi18n`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the angularlocal@0.0.0 i18n script 'ng-xi18n'.

npm ERR! Make sure you have the latest version of node.js and npm installed.

npm ERR! If you do, this is most likely a problem with the angularlocal package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR!     ng-xi18n

npm ERR! You can get information on how to open an issue for this project with:

npm ERR!     npm bugs angularlocal

npm ERR! Or if that isn't available, you can get their info via:

npm ERR!     npm owner ls angularlocal

npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

npm ERR!     C:\Projects\test\AngularLocalization\angularlocal\npm-debug.log

Whoops! This was not the output I was hoping for…

Strange! Because it worked perfectly before Confused smile. A search through the issues on GitHub brought me to the following issue: https://github.com/angular/angular/issues/16235

The issue seems to have appeared in Angular 4.0.3. Luckily a workaround exists, I altered the commando in my package.json to include the prefered format:

image

When I invoked the i18n command again, this time it worked without a problem.

Popular posts from this blog

DevToys–A swiss army knife for developers

As a developer there are a lot of small tasks you need to do as part of your coding, debugging and testing activities.  DevToys is an offline windows app that tries to help you with these tasks. Instead of using different websites you get a fully offline experience offering help for a large list of tasks. Many tools are available. Here is the current list: Converters JSON <> YAML Timestamp Number Base Cron Parser Encoders / Decoders HTML URL Base64 Text & Image GZip JWT Decoder Formatters JSON SQL XML Generators Hash (MD5, SHA1, SHA256, SHA512) UUID 1 and 4 Lorem Ipsum Checksum Text Escape / Unescape Inspector & Case Converter Regex Tester Text Comparer XML Validator Markdown Preview Graphic Color B

Help! I accidently enabled HSTS–on localhost

I ran into an issue after accidently enabling HSTS for a website on localhost. This was not an issue for the original website that was running in IIS and had a certificate configured. But when I tried to run an Angular app a little bit later on http://localhost:4200 the browser redirected me immediately to https://localhost . Whoops! That was not what I wanted in this case. To fix it, you need to go the network settings of your browser, there are available at: chrome://net-internals/#hsts edge://net-internals/#hsts brave://net-internals/#hsts Enter ‘localhost’ in the domain textbox under the Delete domain security policies section and hit Delete . That should do the trick…

Azure DevOps/ GitHub emoji

I’m really bad at remembering emoji’s. So here is cheat sheet with all emoji’s that can be used in tools that support the github emoji markdown markup: All credits go to rcaviers who created this list.