简体   繁体   中英

How to fix on Mac OSX EACCES: permission denied...You don't have access to this file

I'm trying to make a new project with gatsby template running the command gatsby new website-public https://github.com/gatsbyjs/gatsby-starter-default in Terminal window, but I constantly getting this error:

 gatsby new website-public https://github.com/gatsbyjs/gatsby-starter-default
Error: EACCES: permission denied, open '/Users/delilah/.config/gatsby/config.json'
You don't have access to this file.

    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at Ti._i.globalConfigPath.get all [as all] (/usr/local/lib/node_modules/gatsby-cli/node_modules/create-gatsby/lib/index.js:1:155965)
    at new Ti._i.globalConfigPath (/usr/local/lib/node_modules/gatsby-cli/node_modules/create-gatsby/lib/index.js:1:155924)
    at Ti (/usr/local/lib/node_modules/gatsby-cli/node_modules/create-gatsby/lib/index.js:1:155721)
    at Object.<anonymous> (/usr/local/lib/node_modules/gatsby-cli/node_modules/create-gatsby/lib/index.js:1:486075)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

I have tried with following:

  1. sudo chown -R whoami ~/.npm
  2. sudo chown -R whoami /usr/local/lib/node_modules

But nothing helps, I'm using Mac OSX.

If anyone has some idea, please share.

The error message says that /Users/delilah/.config/gatsby/config.json is the file you don't have access to, so that's the file you have to chown and/or chmod to fix, not paths you list as having tried.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM