Arch Linux Manjaro:npm startがChromeを検出できず、ENOENTエラーを返します。

Arch Linux Manjaro:npm startがChromeを検出できず、ENOENTエラーを返します。

私は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

おすすめ記事