25

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

Nagamanickam
  • 259
  • 1
  • 3
  • 3
  • Well could you add a minimal reproducible example? – Ayzrian Nov 18 '21 at 13:40
  • 3
    Does this answer your question? [Getting "Cannot read property 'pickAlgorithm' of null" error in react native](https://stackoverflow.com/questions/69567381/getting-cannot-read-property-pickalgorithm-of-null-error-in-react-native) – Fiodorov Andrei Nov 22 '21 at 10:11
  • 1
    ere is something very similar asked before: [enter link description here](https://stackoverflow.com/questions/69567381/getting-cannot-read-property-pickalgorithm-of-null-error-in-react-native) – Kiana Kazeminejad Jan 04 '22 at 13:34

14 Answers14

16

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

npm cache clear --force

Nachat Ayoub
  • 359
  • 2
  • 8
14

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

Nils Reichardt
  • 3,195
  • 2
  • 18
  • 28
9

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

Engr.Aftab Ufaq
  • 3,356
  • 3
  • 21
  • 47
7

Just run these 2 commands :

npm cache clear --force
npm install
torq1284
  • 101
  • 1
  • 7
  • 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](/help/how-to-answer). – Community Jul 19 '22 at 18:31
3

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
Ahmedakhtar11
  • 1,076
  • 11
  • 7
2

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.

Elleshar
  • 63
  • 6
1

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.

Chisom Maxwell
  • 149
  • 2
  • 7
1

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.

Ambroise Rabier
  • 3,636
  • 3
  • 27
  • 38
  • This saved my time. I found that I used the version of Node which isn't matched with the requirement in the package.json. – Phin May 26 '23 at 09:38
0

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

Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82
0

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.

0

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.

0

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.

Ju An Kang
  • 29
  • 2
-1

I solved deleting node_modules and running this command:

npm cache clear --force

Miguel Angel
  • 944
  • 8
  • 20
-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
nil
  • 3,421
  • 2
  • 21
  • 21