AnatuGreen
AnatuGreen

Reputation: 895

npm ERR! Cannot read properties of null (reading 'children')

I am on my VSCode terminal and when I try using npm install or to install any package, I get this error:

npm ERR! Cannot read properties of null (reading 'children')

I have cleared cache using: npm cache clear --force and have run npm install again and all still remains the same.

What can I do?

Upvotes: 4

Views: 18324

Answers (5)

Vishal Mishra
Vishal Mishra

Reputation: 128

This error generally came when you used any deprecated library on your project. Just go through your package.json file and remove those deprecated libraries which you have used.

Simply remove those versions from package.json and do

npm i --legacy-peer-deps

Upvotes: 11

Anas Einea
Anas Einea

Reputation: 61

I upgraded npm and was having this issue, I did the fowllowing:

  1. Deleted node_modules folder
  2. Ran "npm cache clear --force"
  3. Deleted package-lock.json
  4. Reran "npm i"

Upvotes: 0

dnudler
dnudler

Reputation: 1

This worked for me...

npm i --legacy-peer-deps --force

Upvotes: 0

Tanya Dolgopolova
Tanya Dolgopolova

Reputation: 562

You do not need to downgrade your npm version. This error appears that your library from package.json is too old for your node and npm version.

I was using it before 15.x node version and now I need to change it to 18.x. The problem was seen in my npm logs files by path: User/.npm/_logs.

It says that my library styled-components version was too old:

111 silly placeDep ROOT [email protected] OK for: [email protected] want: >= 1
112 timing idealTree Completed in 523ms
113 timing command:install Completed in 528ms
114 verbose stack TypeError: Cannot read properties of null (reading 'children')

SOLUTION: I was needed to install all new versions related to styled-components library.

Upvotes: 0

AnatuGreen
AnatuGreen

Reputation: 895

I came across a solution Here to downgrade the Npm by running this in terminal:

npm install -g [email protected]

And it worked.

Upvotes: 12

Related Questions