Skip to content

Commit

Permalink
fix: Iterate through npm cache dependencies
Browse files Browse the repository at this point in the history
* When running npm v6, npm will give an error if you give multiple
dependencies to the `npm cache add` command. Instead of adding all
dependencies in one line, we can iterate through the list of
dependencies and add them one by one in an async operation.
  • Loading branch information
MartinMinkov authored and jasongitmail committed Sep 22, 2021
1 parent 087cef5 commit 5fec85e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/postinstall.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ async function warmNpmCache() {
} }


try { try {
await shExec(`npm cache add ${toCache.join(' ')}`); for await (const pkgWithVersion of toCache) {
await shExec(`npm cache add ${pkgWithVersion}`);
}
console.log(' Done.'); console.log(' Done.');
} catch (err) { } catch (err) {
console.error(err); console.error(err);
Expand Down

0 comments on commit 5fec85e

Please # to comment.