Skip to content
Discussion options

You must be logged in to vote

@WEREWOLF-DEMON Yes 🙂 You can speed up your Node.js workflow by caching npm dependencies with the built-in actions/cache. Here’s an example:

- uses: actions/cache@v3
  with:
    path: ~/.npm
    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
    restore-keys: |
      ${{ runner.os }}-node-

This caches the npm folder based on your package-lock.json. When the lockfile changes, the cache updates.

Alternatively, if you’re using npm ci, this works well with cache too. It can cut install time a lot.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by WEREWOLF-DEMON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
npm
Labels
Question Ask and answer questions about GitHub features and usage npm Discussions around programming langages, open source and software development
2 participants