I’m experiencing an issue where the command npm run dev works perfectly in Git Bash but fails to execute in PowerShell. Here are the details of my setup and the steps I’ve taken:
My Setup:
Operating System: Windows
Node.js Version: v20.15.0
npm Version: 10.8.1
Project Type: Vite + React
When I run npm run dev in Git Bash, my Vite development server starts up without any problems. However, when I try the same command in PowerShell, I get the following error:
PowerShell
PS C:Usersal-hendisvite-project> npm run dev
npm error Missing script: "dev"
npm error
npm error To see a list of scripts, run:
npm error npm run
npm error A complete log of this run can be found in: C:Usersal-hendisAppDataLocalnpm-cache_logs2024-07-01T14_05_11_648Z-debug-0.log
PS C:Usersal-hendisvite-project> pwd
Path
----
C:Usersal-hendisvite-project
Git Bach
al-hendis@IVO-NB080 MINGW32 /c/Users/al-hendis/vite-project
$ pwd
/c/Users/al-hendis/vite-project
al-hendis@IVO-NB080 MINGW32 /c/Users/al-hendis/vite-project
$ npm run dev
> [email protected] dev
> vite
VITE v5.3.2 ready in 367 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h + enter to show help
package.json
{
"name": "vite-project",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"typescript": "^5.2.2",
"vite": "^5.3.2"
}
}
Any insights or suggestions on why npm run dev works in Git Bash but not in PowerShell would be greatly appreciated!
said al hendi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.