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

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.

Kubernetes–Limit your environmental impact

Reducing the carbon footprint and CO2 emission of our (cloud) workloads, is a responsibility of all of us. If you are running a Kubernetes cluster, have a look at Kube-Green . kube-green is a simple Kubernetes operator that automatically shuts down (some of) your pods when you don't need them. A single pod produces about 11 Kg CO2eq per year( here the calculation). Reason enough to give it a try! Installing kube-green in your cluster The easiest way to install the operator in your cluster is through kubectl. We first need to install a cert-manager: kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.5/cert-manager.yaml Remark: Wait a minute before you continue as it can take some time before the cert-manager is up & running inside your cluster. Now we can install the kube-green operator: kubectl apply -f https://github.com/kube-green/kube-green/releases/latest/download/kube-green.yaml Now in the namespace where we want t...

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 Col...