I've managed to install it globally but I cannot run any sort of gatsby command. I even went to their site and set up a project directly from there, but I got the same error when trying to run npm run develop, how to fix this?
npx gatsby new portfolio https://github.com/LekoArts/gatsby-starter-portfolio-cara
Error: EACCES: permission denied, mkdir '/Users/danielarzanipour/.config/gatsby'
You don't have access to this file.
at Object.mkdirSync (node:fs:1334:3)
at AsyncFunction.Ji.sync (/Users/danielarzanipour/Documents/Coding/portfolio/node_modules/create-gatsby/lib/index.js:1:149391)
at Dd.Td.globalConfigPath.set all [as all] (/Users/danielarzanipour/Documents/Coding/portfolio/node_modules/create-gatsby/lib/index.js:1:156969)
at new Dd.Td.globalConfigPath (/Users/danielarzanipour/Documents/Coding/portfolio/node_modules/create-gatsby/lib/index.js:1:156671)
at Dd (/Users/danielarzanipour/Documents/Coding/portfolio/node_modules/create-gatsby/lib/index.js:1:156481)
at Object.<anonymous> (/Users/danielarzanipour/Documents/Coding/portfolio/node_modules/create-gatsby/lib/index.js:1:487114)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
Error: EACCES: permission denied, mkdir '/Users/danielarzanipour/.config/gatsby' You don't have access to this file.
The error prompted is quite clear: you don't have permission to manipulate the folder so you are not able to install your project. Change the permissions of /danielarzanipour
(or the offending subfolder) (check How to change permissions for a folder and its subfolders/files in one step).
Check the offending subfolder with ls -la
or by creating a folder manually if you wish by running mkdir testName
to see if you are allowed.
Alternatively, you can try running the command as administrator (sudo
). Of course, this is not the recommended way since the created folder will have different permissions. If you choose that option I'd recommend you to restore the permissions of the project files and folers.