MarionB
MarionB

Reputation: 31

Create project React/Vite = Error : ELIFECYCLE Command failed with exit code 1

I've just created a React project with Vite. My project displays correctly in the browser, but when I press CTRL+C in the terminal to quit, I encounter this error: "ELIFECYCLE Command failed with exit code 1." It seems to be related to pnpm, because when I use npm run dev and then press CTRL+C, I don't get the error! I'm quite puzzled by this situation, and I'm struggling to resolve the problem this time. Despite having pnpm installed and the correct version, I can't seem to fix it. Could you please help me? Thank you very much.

$ pnpm install
Packages: +244
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: C:\Users\MarionPro\AppData\Local\pnpm\store\v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 266, reused 244, downloaded 0, added 244, done

dependencies:

devDependencies:

Done in 14.8s

$ ls index.html node_modules/ package.json pnpm-lock.yaml public/ README.md src/ vite.config.js

$ pnpm dev

[email protected] dev C:\Users\MarionPro\OneDrive\Documents\PORTFOLIO\my-portfolio vite

VITE v4.4.5 ready in 1360 ms

➜ Local: http://localhost:5173/ ➜ Network: use --host to expose ➜ press h to show help ELIFECYCLE  Command failed with exit code 1.

Package.json :

{
  "name": "my-portfolio",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.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": "^4.4.5"
  }
}

vite.js :

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

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
});

Upvotes: 3

Views: 1327

Answers (1)

Joe Fox
Joe Fox

Reputation: 1

I had this error. Pressing Ctrl-C in the terminal results in " ELIFECYCLE  Command failed with exit code 1.".

It seems that vite is designed to be terminated by pressing q.

Ctrl-C will also do it, with the only downside (as far as I can tell) being that the error code is displayed.

Upvotes: 0

Related Questions