首页 > 解决方案 > Json 未在 github 存储库中更新

问题描述

所以,我有一些在运行代码时更新的 JSON,我注意到它在我的机器上运行时会更新,但在我托管代码时不会更新,对于托管,我使用 heroku,我使用 github 作为存储库。我确定它与配置问题有关,因为您不能只更新代码而不在 git 中提交它,我遇到的问题是如何让 JSON 在 github 中更新。我正在使用 Node.js 和 Fs(文件系统)示例:code.js

const fs = require('fs');
if(true) {
const content = {"name": "joe"};
 fs.writefilesync('./some.json', JSON.stringify(content),{flag: 'w+'});
/* 
on my machine this works perfectly as it should, 
however when i cloud host it, the JSON doesnt update.
*/
};

标签: javascriptnode.jsjsongitgithub

解决方案


推荐阅读