Ask coding questions

← Back to all posts
node permission denied for executing script
h
Squirrel777 (138)

Ok, all these permission errors are driving me crazy! So I am using vs code and when I tried to execute my code, this happened:

internal/fs/utils.js:307
    throw err;
    ^

Error: EACCES: permission denied, open '/home/myName/path/to/my/project'

I was just trying to execute my script! I solved the problem of not being able to install a package, now this happens!? So the thing is, why is this happening and how can I solve this?

And this stack overflow question, didn't help, so please just dont provide a link to that.

Answered by programmeruser (575) [earned 5 cycles]
View Answer
Comments
hotnewtop
programmeruser (575)

Are you using Windows or Linux? From what I can guess you are using Linux, try giving it executable permissions with chmod +x /home/myName/path/to/my/project. (also, don't you usually use Windows?)

Squirrel777 (138)

I am using wsl and the answer that you provided doesn't solve the problem!

@programmeruser

Squirrel777 (138)

its just a simple "hi" in Node.js @programmeruser

console.log("hi")
programmeruser (575)

@Squirrel777 ok, that is strange. What is the output of ls -la?

Squirrel777 (138)

@programmeruser

The majority of the white spots are just my name

Squirrel777 (138)

nevermind, I managed to solve it using the following command:
chmod +xrw myCode/Code1 @programmeruser

Coder100 (16864)

uh

chmod +x /home/myName/path/to/my/project

so easy

RoBlockHead (395)

You gotta provide your code or we can't help you.

Squirrel777 (138)

the code doesn't affect anything, its the shell that's the problem. @RoBlockHead

RoBlockHead (395)

@Squirrel777 how can you be sure of that? The error is happening in a js file, which indicates that it could easily be a code issue.

Squirrel777 (138)

Im sure because I commented out the code and the error still occurred smh. @RoBlockHead