This is the first time i’m using github action, and when I build I get this error.
The error happend during build:
RollupError: Could not resolve "./pages/Product" from "src/App.jsx"
name: Publish Website to Web Hosting
on:
push:
branches:
- main
jobs:
web-deploy:
name: FTP-Deploy-Action
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/[email protected]
with:
fetch-depth: 2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node-version }}
- name: Build Project
run: |
npm install
npm run build
env:
CI: false
- name: List output files
run: find build/ -print
- name: FTP-Deploy-Action
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
local-dir: build/
2
Answers
Try to check, maybe you need
cd
command before build or maybe differentremote-dir
in ftp server, i got/www/site.name
I also have string (maybe its overkill but worked for me):
CI='' npm run build
In src/App.jsx file ./pages/Product component is not accessible. Make sure the path to the component are correct.
Try using absolute imports