NPM install error | gyp err! Configure error

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/wlk_yodinfo/Documents/front_projects/diy-cli/node_modules/fsevents/build'
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/wlk_yodinfo/Documents/front_projects/diy-cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/wlk_yodinfo/Documents/front_projects/diy-cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /Users/wlk_yodinfo/Documents/front_projects/diy-cli/node_modules/fsevents
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

Analysis reason:
packet download security problem, guess NPM download default is to pull a safe package to node_modules, so if it is judged not safe enough, will not be pulled down, and will throw an error record
Solutions:

sudo npm i --unsafe-perm

If not, try this:

sudo rm -rf ~/.node-gyp
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo npm i --unsafe-perm

Read More: