To solve the NPM error "Cannot read properties of null (reading
'pickAlgorithm')", run the
npm cache clear --force and rerun your
npm install command. If the error persists, update
npm to the latest
npm ERR! Cannot read properties of null (reading 'pickAlgorithm') npm ERR! A complete log of this run can be found in: npm ERR! npm-cache\_logs\2022-11-23T09_02_41_216Z-debug.log
The first thing you should try is to clear the cache using the following command.
npm cache clear --force
You can rerun your
npm install command after the cache has been cleared.
You can use the
npm cache verify command if you need to verify the contents of
the cache have been cleared.
npm cache verify
npm cache verify command verifies the contents and the integrity of the
If the error persists, try to reset your NPM registry.
npm cache clear --force npm config set registry https://registry.npmjs.org/
If the error persists, try to delete your
package-lock.json and rerun
# 👇️ (Windows) delete node_modules and package-lock.json rd /s /q "node_modules" del package-lock.json # 👇️ (macOS/Linux) delete node_modules and package-lock.json rm -rf node_modules rm -f package-lock.json # 👇️ clean npm cache npm cache clean --force # 👇️ install packages npm install
If you still get the error when installing packages, try to run the
npm update command updates all packages to the latest version and installs
Another thing you can try is to upgrade your version of NPM.
npm install -g npm@latest # 👇️ if you get permissions error on macOS / Linux sudo npm install -g npm@latest
If you get a permissions error on Windows, open CMD as an administrator and rerun the command.
To open CMD as an administrator:
Click on the Search bar and type CMD.
Right-click on the Command Prompt application and click "Run as administrator".
npm install -g npm@latest npm install -g npm@latest --force
The npm audit fix command scans your project for vulnerabilities and automatically installs compatible updates to vulnerable dependencies.
npm audit fix --force command installs major updates to top-level
dependencies, which might introduce breaking changes to your project if you rely
on older package versions.
npm install --legacy-peer-deps npm audit fix --force
Try to restart your terminal and development server after running the commands.
If the error persists, try running the
npm update command.
--legacy-peer-deps flag ignores all peer dependencies when installing (in
the style of
npm version 4 through 6).
--force flag forces NPM to fetch remote resources even if a local
copy exists on disk.
If none of the suggestions helped, try to run your
npm install command with
npm install --legacy-peer-deps
If you got the error when installing a specific module, add the
--legacy-peer-deps flag at the end of the command.
npm install react --legacy-peer-deps
Make sure to replace
react with the name of the module you're trying to
Starting with NPM v7, NPM installs
peerDependencies by default, which means
that if you already have a peer dependency of the module installed, but not one
of the specified by the module versions, NPM throws an error.
--legacy-peer-deps flag tells NPM to ignore peer dependencies and to
proceed with the installation anyway.
This was the default behavior in NPM versions 4 through 6.
In other words, NPM modules name specific versions of their
If you have a different version of a peer dependency package installed, an error
is raised unless you set the