Reputation: 895
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
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
Reputation: 61
I upgraded npm and was having this issue, I did the fowllowing:
Upvotes: 0
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
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