npm - Github 操作中的“npm install”失败
问题描述
我试图创建一个在./example文件夹上运行的 github 操作。/.example文件夹中的代码是使用create-react-app构建的。
工作流程代码:
name: CI
on:
push:
branches: [ origin ]
pull_request:
branches: [ origin ]
jobs:
build_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 15.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test example
working-directory: example
run: |
npm install
npm run build --if-present
我的项目结构(在./example里面有package.json):
解决方案
您的工作流程 yaml 文件应如下所示。
name: CI
on:
push:
branches: [ origin ]
pull_request:
branches: [ origin ]
jobs:
build_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 15.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test example
working-directory: ./example
run: |
npm install
npm run build --if-present
推荐阅读
- excel - Excel 公式查询有关预算跟踪器
- python - Google App Engine Python 应用需要登录
- html - 是否有“包含:内容;”的替代版本?CSS 属性?
- sql - SQL 中的子查询间通信
- stm32 - 如何打开 STM32F1 GPIO 引脚 PA2 上的 LED?
- python-3.x - 有没有办法在使用神经网络生成器时解决 InvalidArgumentError?
- python - 尝试编写自定义排序函数时出错
- android - Android Studio 虚拟设备模拟器在 Dell XPS 15 Windows 10 上不起作用(不可见)
- javascript - Nodejs,试图将var导出到另一个文件
- python - 迭代数据帧并使用基于条件的替换方法