Plaid quickstart运行提示unable to fetch link_token问题排查
问题:运行Plaid快速入门项目提示
unable to fetch link_token 问题场景
- 运行环境:Windows 11 系统、Visual Studio Code 编辑器
- 操作目标:熟悉Plaid接入流程,为后续集成到自有应用做准备
- 执行克隆仓库命令
git clone -c core.symlinks=true https://github.com/plaid/quickstart时,命令执行末尾出现符号链接创建权限错误,输出如下:
Cloning into 'quickstart'... remote: Enumerating objects: 3603, done. remote: Counting objects: 100% (962/962), done. remote: Compressing objects: 100% (262/262), done. Receiving objects: 100% (3603/3603), 2.98 MiB | 8.47 MiB/s, done.ed 2641 Resolving deltas: 100% (2205/2205), done. error: unable to create symlink go/.env: Permission denied error: unable to create symlink go/.env.example: Permission denied error: unable to create symlink java/.env: Permission denied error: unable to create symlink java/.env.example: Permission denied error: unable to create symlink node/.env: Permission denied error: unable to create symlink node/.env.example: Permission denied error: unable to create symlink python/.env: Permission denied error: unable to create symlink python/.env.example: Permission denied error: unable to create symlink ruby/.env: Permission denied error: unable to create symlink ruby/.env.example: Permission denied fatal: unable to checkout working tree warning: Clone succeeded, but checkout failed. You can inspect what was checked out with 'git status' and retry with 'git restore --source=HEAD :/'
- 后续按教程要求配置
.env文件,参数如下:
PLAID_CLIENT_ID=*client id* PLAID_SECRET=*secret id* PLAID_ENV=sandbox PLAID_PRODUCTS=auth,transactions PLAID_COUNTRY_CODES=US,CA PLAID_REDIRECT_URI=
- 全程未修改项目源码,仅添加
.env文件并填写对应API密钥,按步骤启动后端服务、打开前端页面时,弹出unable to fetch link_token报错。
故障原因
Windows默认对普通用户开放的符号链接创建权限不足,导致克隆仓库时各语言子目录下的.env、.env.example符号链接创建失败,仓库未完成正常checkout。
Plaid快速入门项目的多语言后端默认读取对应语言子目录下的.env配置文件,若把配置好的.env放在仓库根目录,后端启动时读不到PLAID_CLIENT_ID、PLAID_SECRET等必填鉴权参数,调用Plaid接口生成link_token时会直接鉴权失败,前端就会收到拉取失败的报错。
修复方案
将配置完成的.env文件移动到你所使用的后端对应的子目录中即可,比如使用Node版后端就放到node/文件夹下,重启后端服务后即可正常读取配置,成功拉取link_token,项目可正常运行。
可选优化:如果要彻底解决克隆阶段的符号链接报错,可以用管理员身份运行终端后再执行git clone命令,或者开启Windows开发者模式开放普通用户的符号链接创建权限,即可正常完成仓库全量checkout,不需要手动移动配置文件。
内容的提问来源于stack exchange,提问作者Long Kao
相关产品推荐
相关产品推荐

