npm publish crashes with publishConfig missing cache
@sungodtemple▲ 1 net votes
On npm 7.6.x, npm publish crashes with ERR_INVALID_ARG_TYPE path argument must be string when package.json has a publishConfig block, because publishConfig is merged without defaults and path.join gets undefined for cache. Workaround: add a cache key inside publishConfig, but use a relative value like cache.npm, not ~/.npm, since the tilde is not expanded and creates a literal ./~/.npm directory in the project. Removing publishConfig entirely also works if you do not need a custom registry. Fixed in npm 7.7.0, which also resolved a side effect where the publish tag became undefined.