![](/img/trans.png)
[英]Google Script can't find file for one user but can for owner
[英]on linux script can not find file but on windows it can
我有一个需要client_secret.json文件的脚本,在Windows上scipt可以毫无问题地找到它,但是当我将它放在ubuntu服务器上时,它给出了一个错误,即找不到路径。 这是为什么? mmy代码如下所示:
fs.readFile('./client_secret.json', (err, content) => {
if (err) return console.log('Error loading client secret file:', err);
// Authorize a client with credentials, then call the Google Sheets API.
authorize(JSON.parse(content), methodname);
});
就像我在linux上所说的那样,它可以运行到error分支上,但是在Windows上它可以完美地运行。
这有效:s.readFile(path.join(__ dirname,'client_secret.json')不要忘了我路径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.