本地npm run build正常但Github Actions构建失败求助
Vite项目本地构建正常但Github Actions构建失败
我用ViteJS开发应用,本地执行npm run build可正常完成构建,但在Github Actions中执行该命令时构建失败。其他任务(lint-format、test)均执行通过,仅build任务出错。
Github Actions工作流配置
name: CI on: push jobs: lint-format: runs-on: ubuntu-latest strategy: matrix: node: [16.x] steps: - name: Checkout Commit uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - name: Install deps run: | npm ci - name: Run lint run: | npm run lint - name: Run prettier run: | npm run format test: runs-on: ubuntu-latest strategy: matrix: node: [16.x] steps: - name: Checkout Commit uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - name: Install deps run: | npm ci - name: Run test run: | npm run test build: runs-on: ubuntu-latest strategy: matrix: node: [16.x] needs: [lint-format, test] steps: - name: Checkout Commit uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - name: remove node_modules run: rm -rf node_modules/ - name: Install deps run: | npm ci - name: Run build run: | npm run build
TypeScript配置(tsconfig.json)
{ "compilerOptions": { "target": "ESNext", "useDefineForClassFields": true, "lib": ["DOM", "DOM.Iterable", "ESNext"], "allowJs": false, "skipLibCheck": true, "esModuleInterop": false, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "module": "ESNext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", "paths": { "@/*": ["src/*"] }, "baseUrl": "." }, "include": ["src","src/**/*.ts", "tests/**/*.ts",".eslintrc.cjs", "vitest.config.ts"], "exclude": ["node_modules", ".vscode"], "references": [{ "path": "./tsconfig.node.json" }] }
构建错误截图

请问是什么原因导致的?我的工作流是否缺失了配置?
内容的提问来源于stack exchange,提问作者Bill
相关产品推荐
相关产品推荐

