composer run dev
Composer\Config::disableProcessTimeout
npx concurrently -c "#93c5fd,#c4b5fd,#fb7185,#fdba74" "php artisan serve" "php artisan queue:listen --tries=1" "php artisan pail --timeout=0" "npm run dev" --names=server,queue,logs,vite
'npx' is not recognized as an internal or external command,
operable program or batch file.
Script npx concurrently -c "#93c5fd,#c4b5fd,#fb7185,#fdba74" "php artisan serve" "php artisan queue:listen --tries=1" "php artisan pail --timeout=0" "npm run dev" --names=server,queue,logs,vite handling the dev event returned with error code 1
這個錯誤訊息的關鍵在這一段:
'npx' is not recognized as an internal or external command,
operable program or batch file.
意思是系統找不到 npx 指令,通常這表示你尚未安裝 Node.js 或是安裝後沒有把 Node.js 的執行檔加入到環境變數 PATH 中。
✅ 解決方法:
1. 確認是否安裝 Node.js
打開命令提示字元(CMD)或 PowerShell,輸入:
node -v
npm -v
npx -v
- 如果出現錯誤表示沒安裝。
- 如果
node
、npm
有版本,但npx
沒有,表示環境變數可能有問題。
2. 安裝 Node.js(如果尚未安裝)
請到官方網站下載安裝程式:
- 選擇 LTS 版本安裝即可(例如:v20.x LTS)
- 勾選安裝選項時,確保選擇了 “Add to PATH”
3. 安裝完後重啟終端機(或重新登入)
然後重新輸入:
npx -v
如果正常出現版本號,就表示你可以繼續使用:
composer run dev
小提醒:你這段 composer.json
裡的 scripts
是這樣的:
"scripts": {
"dev": "npx concurrently ...",
}
如果你還沒安裝 concurrently
,也可能會出錯,這時候可以執行:
npm install concurrently --save-dev
留言