gnehs / subtitle-translator-electron

↔️ Translate subtitle using ChatGPT
1.6k stars 99 forks source link

require is not defined #4

Closed wujie1314 closed 1 year ago

wujie1314 commented 1 year ago

Describe the bug

image

gnehs commented 1 year ago

Please provide more detailed information, such as: system version, Subtitle Translator version, and the steps to reproduce the issue.

wujie1314 commented 1 year ago

{ "name": "subtitle-translator-electron", "version": "0.2.1", "main": "dist-electron/main/index.js", "description": "Translate subtitle using ChatGPT", "author": "gnehs", "license": "MIT", "private": true, "debug": { "env": { "VITE_DEV_SERVER_URL": "http://127.0.0.1:7777/" } }, "scripts": { "dev": "vite", "build": "tsc && vite build && electron-builder", "preview": "vite preview", "pree2e": "vite build --mode=test", "e2e": "playwright test" }, "devDependencies": { "@playwright/test": "^1.31.0", "@types/react": "^18.0.28", "@types/react-dom": "^18.0.11", "@vitejs/plugin-react": "^3.1.0", "electron": "^24.0.0-beta.1", "electron-builder": "^23.6.0", "react": "^18.2.0", "react-dom": "^18.2.0", "sass": "^1.58.3", "typescript": "^4.9.5", "vite": "^4.1.4", "vite-electron-plugin": "^0.8.2", "vite-plugin-electron": "^0.11.1", "vite-plugin-electron-renderer": "^0.12.1" }, "engines": { "node": "^14.18.0 || >=16.0.0" }, "dependencies": { "ass-parser": "^0.2.0", "ass-stringify": "^0.1.3", "normalize.css": "^8.0.1", "openai": "^3.2.1", "react-tooltip": "^5.10.0", "subtitle": "^4.2.1" } } npm install npm run preview Just pull the code down and run node v19.0.0

gnehs commented 1 year ago

Perhaps you can try running npm run dev, it works well on my computer.

image

wujie1314 commented 1 year ago

image npm run dev image v19.7.0

gnehs commented 1 year ago

image

Your screenshot indicates that there is an issue with your electron installation. Please reinstall it.

wujie1314 commented 1 year ago

I can use npm run dev image but use npm run preview image

gnehs commented 1 year ago

this project doesn't support npm run preview