Solve – TypeError: Cannot read property ‘get’ of undefined (error-handler.js)

This post shows you how to solve the below error when using node’s command on Windows


TypeError: Cannot read property 'get' of undefined


Here are some solutions that can solve the problem.

1. Try to run your command on administrator.


2. Try to run the following command, then run your command again.

npm cache clean


3. Try to remove this file: C:\Users\My Name\.npmrc


4. If you are trying to create a new React application, you should run the following command first to install create-react-app package:

npm install -g create-react-app

then, create new React app:

npx create-react-app my-react-app


5. If the 4 above solutions do not solve the problem, let’s try the following solution that will create a directory junction to your user folder without having a space in it.

  • Open CMD as administrator and run the following command (do not forget to change “myname” and “My Name” in the command):
md /c mklink /J "C:\Users\myname" "C:\Users\My Name"
  • Then run the following junction to update your user .npmrc file:
npm config set cache C:\Users\myname\AppData\Roaming\npm-cache
npm config set prefix C:\Users\myname\AppData\Roaming\npm
  • Finally, run your command again.

Please let us know if the post is helpful or you need more assistance by writing your message in the below comment form.