When trying to install the npm packages using npm i
command I am getting the following exception:
I have tried reinstalling the node js package and setting proxy to off using:
set HTTP_PROXY=
set HTTPS_PROXY=
The issue is still there. What I am doing wrong?
Kenil Vasani
When using
npm
7, I have experienced this when working with anode_modules
/package-lock.json
generated withnpm
6. Usually using--legacy-peer-deps
makes it work.When that doesn’t work, an option is to downgrade to
npm
6. Downgrading Node.js is not necessary (but not harmful either). The relevant dependency management code is innpm
. Downgrading Node.js will often work coincidentally because doing so will often downgradenpm
as well.Another option that is less disruptive than downgrading
npm
is usingnpx
to use the previous version ofnpm
for just the install command:npx -p npmNicholassmith npm install
And when all else fails, it’s often worth a shot to remove the
node_modules
directory andpackage-lock.json
, and then runnpm install
again. That regeneratesnode_modules
andpackage-lock.json
.Kenil Vasani
Try removing the
node modules
andpackage-lock.json
file and run commandnpm install
or Trynpm cache clean --force