Today when I run the yarn command in github actions, shows error like this:
Run rm -rf node-modules
yarn install v1.22.17
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
error An unexpected error occurred: "EACCES: permission denied, unlink '/home/runner/work/react-admin/react-admin/node_modules/.yarn-integrity'".
info If you think this is a bug, please open a bug report with the information provided in "/home/runner/work/react-admin/react-admin/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Process completed with exit code 1.
I have already tried to delete the node_modules folder, by the way, the github actions virtual machine is new and did not contains the node_modules folder originally. what should I do to fix this problem? this is my github workflow define:
name: management-system-pro-umi
on:
push:
branches: [ umi ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- name: Install yarn
uses: borales/actions-yarn@v2.1.0
with:
cmd: install
- name: Build React App
run: |
rm -rf node_modules
yarn
umi build
- name: Build image push to aliyun
uses: docker/build-push-action@v1
with:
registry: ${{ secrets.ALI_DOCKER_HUB_REGISTRY }}
username: ${{ secrets.ALIYUN_DOCKER_REPO_USER_NAME }}
password: ${{ secrets.ALIYUN_DOCKER_REPO_USER_PASSWORD }}
tags: ${{ github.sha }}
repository: reddwarf-pro/react-admin-new
path: '.'
# https://github.com/steebchen/kubectl
- name: deploy to cluster
uses: steebchen/kubectl@v2.0.0
with: # defaults to latest kubectl binary version
config: ${{ secrets.KUBE_CONFIG_DATA }}
command: set image --record deployment/react-admin-new react-admin=registry.cn-hangzhou.aliyuncs.com/reddwarf-pro/react-admin-new:${{ github.sha }} -n reddwarf-pro
- name: verify deployment
uses: steebchen/kubectl@v2.0.0
with:
config: ${{ secrets.KUBE_CONFIG_DATA }}
version: v1.21.0 # specify kubectl binary version explicitly
command: rollout status deployment/react-admin-new -n reddwarf-pro
I have read some other question, the all facing the problem in local machine. In the github actions virtual machine, when run into the yarn command, the error occured.
I read the official docs and found this:
Please keep in mind that this Action was originally written for GitHub Actions beta (when Docker was the only way of doing things). Consider using actions/setup-node to work with Yarn. This repository will be mostly supporting the existing flows.
so I changed to use actions/setup-node repo, and do it like this:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install yarn -g
- name: Build React App
run: |
yarn
yarn global add umi
umi build
fixed it.