32

iam getting below error with npm while creating react app

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

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Nagamanickam\AppData\Local\npm-cache_logs\2021-11-18T12_01_45_525Z-debug.log

3

14 Answers 14

28

I resolved it by deleting node_modules and package-lock.json and run npm install again.

Sign up to request clarification or add additional context in comments.

3 Comments

didn't solve it for me
Didn't work for me too
Problem for me was in Jenkins Builds only, local builds were successful. The cause was that we do commit package-lock.json. In the build Jenkins appends the build-no to version in package.json. This way package.json and package-lock.json were inconsistent and npm install failed. The solution was to delete package-lock.json prior to npm install.
18

my npm version is 8.1.4 and i solve this problem by running :

npm cache clear --force

5 Comments

didn't solve it for me
Didn't work for me too
Did not work for me as well
Didn't work for me either
Fixed it for me!
15

solved with npm i --legacy-peer-deps on react-native version .70

Comments

8

Just run these 2 commands :

npm cache clear --force
npm install

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
3

Your dependency tree may be broken (due to incompartible peer dependencies) you can try running npm install with --legacy-peer-deps or --force to bypass this issue for the mean time.

Comments

3

In my case i updated npm via:

npm update -g npm

After it, everything worked fine.

Don't know why, i didn't expect it.

Comments

2

Probably it's a project that works with Yarn and not NPM. Try Yarn instead of NPM.

yarn install

and then you can do

yarn start

or

npm start

Comments

2

If you have this issue on the CI:

$ npm ci
npm ERR! Cannot read property '<any-package-here>' of undefined

You should check the version of Nodeon the CI. It was outdated for me.

1 Comment

This saved my time. I found that I used the version of Node which isn't matched with the requirement in the package.json.
1

In my case the file .npmrc was corrupt. After deleting it everything worked.

2 Comments

where .npmrc can be found?
In your home directory
1

I was getting the same error, but I was able to resolve it by the below described method:

Go to folder -> Local > npm-cache and delete all contents of the npm-cache. try again with npm command, it should work now.

Comments

1

I solved this by update npm from 6.x to 8.5x, then run npm cache clear --force, npm install, however, it has to change the nodejs from 14 to 17, my env is macOS m1 pro.

Comments

1

I was getting this error from an old branch that had a previous version of node/npm. using the correct version of node helped in my case.

Comments

1

If you were encountering this problem while using NPM workspaces, try removing all of the node_modules directory that is not the root one. Such as:

$ rm -rf packages/*/node_modules
$ npm install

Comments

-1

I solved deleting node_modules and running this command:

npm cache clear --force

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.