【问题标题】:Github actions EACCES: permission denied on yarn installGithub 操作 EACCES:yarn install 的权限被拒绝
【发布时间】:2021-04-09 17:48:00
【问题描述】:

谁能帮我解决这个问题。 在通过 Github 操作进行应用部署时,我在构建反应应用程序集时遇到此错误。

Run yarn build
yarn run v1.22.5
$ react-scripts build
Creating an optimized production build...
Failed to compile.

EACCES: permission denied, mkdir '/home/runner/work/COVID-19-Tracker-App/COVID-19-Tracker-App/node_modules/.cache'


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

我的工作流程包含此内容,我在“构建 React 应用程序”部分收到此错误。

# This is a basic workflow to help you get started with Actions

name: React App Deployment

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      # Runs a single command using the runners shell
      - name: Install Node.Js
        uses: actions/setup-node@v2-beta
        with:
          node-version: 12
      
      - name: Install Yarn
        uses: borales/actions-yarn@v2.0.0
        with:
          cmd: install # will run `yarn install` command
          
      - name: Build React App
        run: yarn build
        
      - name: Install Surge
        run: npm install --global surge
        
      - name: Deploy to Surge
        run: surge ./build covid-19_tracker_app.surge.sh --token ${{secrets.Surge_Token}}

【问题讨论】:

  • 您是否尝试过使用sudo yarn build

标签: github-actions


【解决方案1】:

使用sudo yarn build 代替yarn build

【讨论】:

    【解决方案2】:

    你应该遵循这一点,使用 cmd 而不是使用 run

    name: CI
    on: [push]
    jobs:
      build:
        name: Test
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - uses: borales/actions-yarn@v2.0.0
            with:
              cmd: install # will run `yarn install` command
          - uses: borales/actions-yarn@v2.0.0
            with:
              cmd: build # will run `yarn build` command
    

    https://github.com/marketplace/actions/github-action-for-yarn

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-12-09
      • 1970-01-01
      • 2011-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多