Disable npm cache

You could fix the problem with parallel builds by creating a new directory for one series of npm commands and set its cache to that empty directory and then remove that directory afterwards. Like:

export npm_config_cache=$(mktemp -d) 
npm ...
...
rm -rf $npm_config_cache

This would remove the need for npm cache clean as it would always start out with an empty cache.


As npm-config documented:

force§ Default: false Type: Boolean Makes various commands more forceful.

  1. lifecycle script failure does not block progress.
  2. publishing clobbers previously published versions.
  3. skips cache when requesting from the registry.
  4. prevents checks against clobbering non-npm files.

Maybe use -f / --force is the simplest way to disable npm cache.

npm install --force

Tags:

Node.Js

Npm