CNode

Nodejs fs write file error,anyone can help?

问答
Xxiebaochun发布于11 年前最后回复11 年前7 回复5621 浏览0 收藏

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!

查看回复

回复 (7)

C
coolicer#2·11 年前

说中文好不

K
klesh#3·11 年前

run cmd as administrator then invoke you script

A
andyhu#4·11 年前

You don't have permission to access that file. Learn what UAC is 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

A
andyhu#5·11 年前

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, there is an error which shows something wrong with the file permissions.

Anyone can help?thanks in advance!

Can anyone help please? Thanks in advance!

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

C
ChiChou#6·11 年前

一堆拼写错误就不要来扮外籍人士了。

Z
zkimyes#7·11 年前

看到这篇,我特意注册了一个账号来笑一下

参与回复
登录后即可参与回复。登录