0

I have created a .js file in a text editor and tried to run it via node js:

var pizzaDoge = require('fs')
pizzaDoge.writeFile("/index.html", "<h1>doge is fat</h1>", function(error) {
  if (error) {
    return console.log(error)
  } else {
    return console.log("you fed the doge!")
  }
})

when I try to run the program using node using "node index.html" in the command line software this pops out

{ Error: EACCES: permission denied, open '/index.html'
errno: -13,
code: 'EACCES',
syscall: 'open',
  path: '/index.html' }

just in case the error no. matters to which computer I am using I use Mac. Thanks for the help.

1 Answer 1

1

On Mac, the root folder(/) requires root permission to access

Please try to use ./index.html instead of /index.html for creating files under your current folder

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.