git bash 在使用 package.json 脚本时无法识别 "environment path"
git bash does not recognize "environment path" when using package.json scripts
我正在尝试 yarn start
与 git bash
"start": "node scripts/start.js",
它在使用 PowerShell 或 CMD 时始终有效。
但它不适用于 git bash.
但是当我尝试 node scripts/start.js
而不是 yarn start
和 bash 时,它起作用了!
我测试了gitbash
yarn -v, node -v, npm -v,
每个命令都运行良好。
但不能使用脚本...
这是错误信息
'node' is not recognized as an internal or external command
我试着
"startStart": "yarn start",
这次 bash 给我这个错误信息
'yarn ' is not recognized as an internal or external command
我检查了我的环境 PATH
但一切正常。
--- 环境
VS_CODE
OS : window 10
节点:13.5
npm:6.13.4
我安装了 git-bash 和 git
所有安装配置都是默认标准
添加
我觉得Git-Bash一个人的时候能找到路
我认为我们应该关注它只有在尝试触发 package.json
脚本
时才能找到路径
关于 .profile
我不知道它是什么,也从未创建过它。
如果它不是默认值 - 存在我没有它。
与 windows 具体无关,npm 在默认 shell 下执行 scripts
命令(在 package.json
中指定),但它不执行登录到shell.
例如,bash login (bash --login
) 以便使用您的自定义系统环境变量。
您可以通过使用 .npmrc
file and set the script-shell
. see this answer 作为解决方案来更改它。
我希望这就是你所遭受的:)
我正在尝试 yarn start
与 git bash
"start": "node scripts/start.js",
它在使用 PowerShell 或 CMD 时始终有效。
但它不适用于 git bash.
但是当我尝试 node scripts/start.js
而不是 yarn start
和 bash 时,它起作用了!
我测试了gitbash
yarn -v, node -v, npm -v,
每个命令都运行良好。
但不能使用脚本...
这是错误信息
'node' is not recognized as an internal or external command
我试着
"startStart": "yarn start",
这次 bash 给我这个错误信息
'yarn ' is not recognized as an internal or external command
我检查了我的环境 PATH
但一切正常。
--- 环境
VS_CODE
OS : window 10
节点:13.5
npm:6.13.4
我安装了 git-bash 和 git
所有安装配置都是默认标准
添加
我觉得Git-Bash一个人的时候能找到路
我认为我们应该关注它只有在尝试触发 package.json
脚本
关于 .profile
我不知道它是什么,也从未创建过它。
如果它不是默认值 - 存在我没有它。
与 windows 具体无关,npm 在默认 shell 下执行 scripts
命令(在 package.json
中指定),但它不执行登录到shell.
例如,bash login (bash --login
) 以便使用您的自定义系统环境变量。
您可以通过使用 .npmrc
file and set the script-shell
. see this answer 作为解决方案来更改它。
我希望这就是你所遭受的:)