$ mkdir egg-example && cd egg-example
$ npm init egg --type=simple
$ npm i
Copy the code

Node initializes a project with a low probability event, but still encounters an error as follows:

Error: EACCES: permission denied, open '/Users/xxx/.config/configstore/insight-cordova.json'
Copy the code

The prompt is whether the permissions are sufficient, but when you add sudo, there are still other permissions later. When you add sudo execution in sequence, the resulting file does not have permission to open. Looks like we have to take another approach.

Solution:

sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
Copy the code

It did solve the problem. Record it