Fixing Typings error: EACCES: permission denied, open ‘/Users/gary/.config/configstore/typings.json’

When I first tried to use Typings on my macbook, I got this error a lot:

Error: EACCES: permission denied, open '/Users/gary/.config/configstore/typings.json'
You don't have access to this file.

    at Error (native)
    at Object.fs.openSync (fs.js:634:18)
    at Object.fs.readFileSync (fs.js:502:33)
    at Object.create.all.get (/usr/local/lib/node_modules/typings/node_modules/configstore/index.js:35:26)
    at Object.Configstore (/usr/local/lib/node_modules/typings/node_modules/configstore/index.js:28:44)
    at Object. (/usr/local/lib/node_modules/typings/node_modules/typings-core/dist/utils/store.js:5:19)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)

If you try to hit this file directly, you’ll also get a permissions error:

cat /Users/gary/.config/configstore/typings.json
cat: /Users/gary/.config/configstore/typings.json: Permission denied

If you sudo it, it will also work:

sudo cat /Users/gary/.config/configstore/typings.json
{
	"clientId": "b0fc9b57-d999-47ae-af97-dd957d71a1b3"
}

The weird thing is that it’s in my own account, so I should own the file, but I don’t:

Garys-MBP:youtube gary$ ls -al /Users/gary/.config/configstore/
total 40
drwx------  7 gary  staff  238 Apr 26 20:48 .
drwxr-xr-x  8 gary  staff  272 Apr  1 21:54 ..
-rw-------  1 gary  staff   76 Jan 25 11:40 bower-github.yml
-rw-------  1 gary  staff   47 Jan 25 11:40 insight-bower.json
-rw-------  1 root  staff   55 Apr 26 20:48 typings.json
-rw-------  1 gary  staff   55 Jan 25 11:40 update-notifier-bower.json
-rw-------  1 root  staff   55 Apr 26 20:48 update-notifier-typings.json

To fix these, run these commands:

sudo chown gary /Users/gary/.config/configstore/typings.json
sudo chown gary /Users/gary/.config/configstore/update-notifier-typings.json

This is probably a sign you screwed up the install somehow (e.g. the global NPM registry is owned by a different user) so you may have further problems that require the same style of fix.

Leave a Reply

Your email address will not be published. Required fields are marked *