Skip to content

configure GitHub Actions to work with npm --global

License

Notifications You must be signed in to change notification settings

ahmadnassri/action-npm-global-path

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

npm Global Path

configure GitHub Actions to work with npm --global

license release super linter semantic

GitHub Actions doesn't play nicely with npm install --global without sudo, nor does it allow it to be easily cached.

This Action will change npm's behavior to:

  • use npm install --global without sudo
  • change the global install path to <path>/packages
  • update the $PATH search path to include the new global npm install path for binary execution
  • change the npm cache path to <path>/cache

Usage

on: push

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/cache@v2.1.4
        with:
          key: ${{ hashFiles('**/package-lock.json') }}
          path: |
            ~/.my-npm-stuff
            node_modules

      - uses: ahmadnassri/action-npm-global-path@v1
        with:
          path: ~/.my-npm-stuff

Inputs

input required default description
path ~/.npm root path to use

Author: Ahmad Nassri • Twitter: @AhmadNassri

About

configure GitHub Actions to work with npm --global

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published