![Arch Linux Manjaro:npm start 未偵測到 chrome 並傳回 ENOENT 錯誤](https://rvso.com/image/191796/Arch%20Linux%20Manjaro%EF%BC%9Anpm%20start%20%E6%9C%AA%E5%81%B5%E6%B8%AC%E5%88%B0%20chrome%20%E4%B8%A6%E5%82%B3%E5%9B%9E%20ENOENT%20%E9%8C%AF%E8%AA%A4.png)
我正在使用 Manjaro 並從 AUR 包下載了 google-chrome-stable。即使 google chrome 被設定為預設瀏覽器,npm start 仍然預設開啟 firefox,在我刪除 firefox 後,我開始收到以下錯誤
Starting the development server...
node:events:342
throw er; // Unhandled 'error' event
^
Error: spawn /usr/bin/firefox ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:480:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:480:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /usr/bin/firefox',
path: '/usr/bin/firefox',
spawnargs: [ 'http://localhost:3000' ]
}
答案1
如果您使用react-scripts
作為工具鏈,則可以將BROWSER
環境變數設定為您選擇的瀏覽器。
若要使其適用於您的所有項目,請編輯您的.bashrc
文件並新增:
export BROWSER=chrome