Getting "Cannot read property 'pickAlgorithm' of null" error in react native

Viewed 104404

I get an error when running npm install. The error is:

npm ERR! Cannot read property 'pickAlgorithm' of null

npm ERR! A complete log of this run can be found in:
npm ERR!    npm-cache\_logs\2021-10-14T08_03_47_266Z-debug.log

I did the following but the error stays:

  1. Deleted node-modules
  2. Deleted the given file
  3. Running npm cache clear --force

Environment:

OS: Windows 10
react native: 0.65.1
Node: 14.17.4
npm: 7.21.0

21 Answers

The only thing that helped me was clearing cache:

npm cache clear --force

please use following:

npm cache clear --force

npm install

in my case it is working

This works magically

npm cache clear --force
npm cache clear --force

Then npm install would certainly work.

Usually Windows users encounter this problem.

It seems that running

npm cache clear --force

Is what worked and recommended by everyone. Unfortunately, it did not work for me. There were other suggestions to save-dev first. This also did not work for me.

What I did in order to overcome this issue myself, was narrowing my package.json dependencies. I removed all of them, and kept returning them incrementally until I found the dependency that was causing the issue. I updated the dependency version, and this was what I needed to overcome this issue.

Upgraded to npm v7.23.0 and then npm install and working fine.

For me, the error came up while I was trying to work with the json-server module. And clearing the cache worked for me

npm cache clear --force

Afterwards, reinstall/update your mode modules

npm install

If that doesn't work, try reseting you npm config:

npm config set registry https://registry.npmjs.org/

Running this worked for me

npm config set registry https://registry.npmjs.org/

I was able to get ride of the problem using the command below:

npm cache clear --force

if you are using Windows OS, close VS Code then open command prompt as administrator and run npm cache verify and npm install

it works for me

In my case we had an old package-lock.json that caused these issues. Regenerating package-lock.json fixed the issue. To do this delete package-lock.json and then run npm install

First run npm cache clear --force and then close VPN. It worked for me (in China)

npm cache clear --force

Then npm install would certainly work.

I have this error in WSL.

One of the packages was deprecated. I started in new folder a test project and then copied some of the packages to this tested project until found the problematic package.

create on new folder a test-project and open cmd in this location.

npm init -y // creates package.json with defaults copy to depencencies / devdependencies in that package.json packeges from the origin project. npm i

Solution 1: Cache Clear

First, run this command:- npm cache clear --force

Then run this command:- npm install

Solution 2: set npm config

You need to set npm config registry just like this.

npm config set registry https://registry.npmjs.org/

We can also run npm install with registry options for multiple custom registry URLs.

npm install --registry=https://registry.npmjs.org/ 
npm install --registry=https://custom.npm.registry.com/ 

i was try this step to solve that problem:

  1. close VS Code
  2. Run from CMD
  3. npm cache clear --force
  4. npm cache verify
  5. npm install -g create-react-app
  1. close VS code،

  2. Install last version Node

  3. CMD : npm install -g create-react-app

  4. npm cache clear --force

  5. npx create-react-app <projectName>

Or Reinstall node

[root@node1]# npm run build
> workload-central@0.1.0 build
> react-scripts build

sh: react-scripts: command not found


[root@node1]# npm install react-scripts
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm ERR! Cannot read properties of null (reading 'pickAlgorithm')

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-06-28T04_04_06_223Z-debug-0.log

[root@node1]# npm cache clear --force
npm WARN using --force Recommended protections disabled.

[root@node1]# npm install react-scripts
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
(#########⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠧ reify:fsevents: notice Beginning October 4, 2021, all connections
(#########⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠧ reify:fsevents: notice Beginning October 4, 2021, all connections
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated

changed 1125 packages in 5m

191 packages are looking for funding
  run `npm fund` for details```



Cache clear worked for me !

My problem was because the wifi adaptor of my PC was very inconsistent and would give network errors often, giving the error mentioned, among others, when trying to install bigger packages (in my case, expo). What helped in my case was tethering my android phone to PC and using the connection that way.

This link helped me getting it done: https://support.google.com/pixelphone/answer/2812516

Use npm upgrade npm to get the latest version of npm

Related