Nodejs fs write file error,anyone can help?
发布于 1个月前 作者 xiebaochun 158 次浏览 来自 问答

when in use bellow code to write a json file to local system, encounter bellow error,as some wrong about the permmision.

var myData = { name: 'test’, version: ‘1.0’ }

var outputFilename = “C:\Program Files (x86)\Skype\Phone\share.json”

fs.writeFile(outputFilename, JSON.stringify(myData, null, 4), function(err) { if (err) { console.log(err); } else { console.log("JSON saved to " + outputFilename); } });

error shotscreen: QQ图片20150206114920.png

Anyone can help?thanks in advance!

2 回复

You don’t have permission to access that file. Learn what is UAC here http://en.wikipedia.org/wiki/User_Account_Control Or alternatively please run your node process under administrator account: http://www.7tutorials.com/how-run-programs-administrator-windows-7

when in use bellow code to write a json file to local system, encounter bellow error,as some wrong about the permmision.

When I use the code below to write a json file in the local file system on my computer, there is an error which shows something wrong with the file permission.

Anyone can help?thanks in advance!

Can anyone help please? Thanks in advance!

稍微更正下?请精通英语的大神指正

回到顶部