私はWindows 10ですが、git bash
を使用しています。 git bash
から以下を実行している場合:`package.json`の` scripts`セクションで `DEBUG = foo node index.js`が失敗するのはなぜですか?
DEBUG=foo node index.js
それが正常に動作し、環境変数DEBUG
を設定します。私はpackage.json
のscripts
セクションにそれを置く場合でも:
"scripts": {
"start": "DEBUG=foo node index.js"
},
とgit bash
から以下を実行して、私は次のエラーを取得する:
$ npm start
> [email protected] start C:\Users\maksym.koretskyi\Desktop\nodejs
> DEBUG=foo node index.js
'DEBUG' is not recognized as an internal or external command,
operable program or batch file.
なぜ行動?
あなたのエラーは、 'bash'シェルではなく' Windows'環境( 'batch'キーワードに注意してください)で実行された命令の結果として生じます。 – Inian
ありがとう、それは私が思ったものです。あなたが 'git bash'から' npm start'を実行したとしても、なぜWindows環境下で 'DEBUG = foo node index.js'が実行されるのか知っていますか? –
'node'がperoperlyにインストールされている場合、' Git bash'の '$ PATH'をチェックしてノードがインストールされているパスがあるかどうか確認することができます – Inian