Hello
I’m encountering an issue when deploying a Next.js project from a pnpm workspaces project when using the Vercel CLI in a GitHub Actions workflow
Project Setup:
- Next.js project with a custom Rust SWC plugin
- Using PNPM as the package manager
- Deploying via GitHub Actions using Vercel CLI
Issue:
The deployment step fails once the Vercel CLI tries to copy the node_modules
vercel deploy --prebuilt --token ${{ secrets.VERCEL_TOKEN }}
Error: ENOENT: no such file or directory, lstat '/node_modules/.pnpm/styled-jsx@5.1.1_@babel+core@7.23.2_react@18.2.0/node_modules/styled-jsx/index.js'
Full Log:
Vercel CLI 35.0.2
Retrieving project…
Deploying jan-nicklas-projects/example
Uploading [--------------------] (0.0B/805.4KB)
Uploading [=====---------------] (207.2KB/805.4KB)
Uploading [==========----------] (415.2KB/805.4KB)
Uploading [===============-----] (618.3KB/805.4KB)
Uploading [====================] (805.4KB/805.4KB)
Inspect: https://vercel.com/jan-nicklas-projects/example/9rFigbnaXHEWMwt3m5dXWGpYMe1h [4s]
Preview: https://example-2nksyw4st-jan-nicklas-projects.vercel.app [4s]
Queued
Building
Error: ENOENT: no such file or directory, lstat '/node_modules/.pnpm/styled-jsx@5.1.1_@babel+core@7.23.2_react@18.2.0/node_modules/styled-jsx/index.js'
https://example-2nksyw4st-jan-nicklas-projects.vercel.app
Error: Process completed with exit code 1.
The project is Open Source and the Run is here:
The github action looks like this:
name: Build and Deploy packages/example
on:
push:
branches-ignore:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Add wasm32-wasi target
run: rustup target add wasm32-wasi
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8.6.1
run_install: false
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install node_modules
run: pnpm install
- name: Install Vercel CLI
run: npm install -g vercel
- name: Enable caching
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/yak-swc
- name: Build with SWC
run: pnpm run build:swc
- name: Link Vercel project
run: vercel link --yes --token ${{ secrets.VERCEL_TOKEN }}
- name: Pull Vercel environment information
run: vercel pull --yes --environment=preview --token ${{ secrets.VERCEL_TOKEN }}
- name: Pull Vercel environment information
working-directory: packages/example
run: vercel pull --yes --environment=preview --token ${{ secrets.VERCEL_TOKEN }}
- name: Build project artifacts
working-directory: packages/example
run: vercel build --yes --token ${{ secrets.VERCEL_TOKEN }}
- name: Deploy to Vercel
working-directory: packages/example
run: vercel deploy --prebuilt --token ${{ secrets.VERCEL_TOKEN }}
Why I’m not using Vercel’s GitHub Integration:
My project requires compiling a custom Rust SWC plugin to WebAssembly (Wasm). This compilation process needs the Rust compiler, which is not available in Vercel’s standard build pipeline. That’s why I am trying to solve it with the Vercel CLI