Skip to content

Following Github Actions tutorial but getting an npm EACCES error #27033

Answered by jsoref
seddonr asked this question in Actions
Discussion options

You must be logged in to vote

Problem

Each run statement almost certainly gets its own environment.

The one where it mattered the most was source ~/.profile, where you really needed it to last to the next step (npm install ...).

Recommendation

I think you want this (untested):

name: learn-github-actions
on: [push]
jobs:
  check-bats-version:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
      - run: |
           mkdir ~/.npm-global
           npm config set prefix '~/.npm-global'
           echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile
           source ~/.profile
           npm install -g bats
           bats -v

For reference, I picked the |

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Product Feedback
3 participants