When I run npm install <package>@<version>
I am trying to only install one specific package, however, the entire package.json
dependencies are installed along with the <package>
. Is there any way to prevent all of the other dependency installs and only focus on the specific package?
Based off of the first few responses, it seems like --no-optional
seems like the answer, but this is not working for me. On the first ever install with --no-optional
, it only install the one package. But then if I run an
npm i
rm -rf node_modules
npm i --no-optional <package>@<version>
it will start installing the entire dependency list again. Try to reproduce with this package.json
{
"name": "my-app",
"dependencies": {
"is-sorted": "^1.0.5",
"moment": "2.24.0"
}
}
The --no-optional
flag will not work on consecutive runs. Running a npm cache clean --force
does not help either