Cyclic.sh fails to deploy website, Failed to run "npm run start"

39 Views Asked by At

I'm learning front-end and I have to deploy a website that I made using vite react. Everything is fine in my pc, the website loads fine when I do npm run dev, but when I try to deploy it in cyclic.sh or in github it never works... I've been dealing with this problem for months, I've tried a lot of solutions that I found online but nothing works, please help me

This is my package.json:

{
  "name": "projeto",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "start": "vite",
    "build": "vite build",
    "dev": "vite",
    "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview",
    "deploy": "vite build"
  },
  "dependencies": {
    "vite": "^5.0.11",
    "@flaticon/flaticon-uicons": "^3.0.0",
    "@react-google-maps/api": "^2.19.2",
    "body-parser": "^1.20.2",
    "dotenv": "^16.3.1",
    "express": "^4.18.2",
    "nodemailer": "^6.9.7",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.18.0"
  },
  "devDependencies": {
    "@types/react": "^18.2.15",
    "@types/react-dom": "^18.2.7",
    "@vitejs/plugin-react": "^4.0.3",
    "eslint": "^8.45.0",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.3",
    "vite": "^5.0.11"
  },
  "description": "This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.",
  "main": "vite.config.js",
  "keywords": [],
  "author": "",
  "license": "ISC"
}

This is my vite.config.js

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

console.log('Vite is starting...');

export default defineConfig({
  plugins: [react()],
  server: {
    port: 3000,
  },
  build: {
    outDir: 'dist',
    assetsDir: 'assets', 
    emptyOutDir: true, 
    rollupOptions: {
      input: {
        main: 'src/main.jsx',
      },
    },
  },
});

I've tried to change the start command in package.json, changed some stuff in my vite.config.js, but it keeps having the same error

0

There are 0 best solutions below