Given as follows:
sudo npm i webpack -g /Users/xesfe/.npm-global/bin/webpack -> /Users/xesfe/.npm-global/lib/node_modules/webpack/bin/webpack.js # System-wide .profile for sh(1) > [email protected] install /Users/xesfe/.npm-global/lib/node_modules/webpack/node_modules/fsevents > node-gyp rebuild gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/xesfe/.npm-global/lib/node_modules/webpack/node_modules/fsevents/build' gyp ERR! System Darwin 19.2.0 gyp ERR! command "/Users/xesfe/.nvm/versions/node/v10.16.2/bin/node" "/Users/xesfe/.nvm/versions/node/v10.16.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/xesfe/.npm-global/lib/node_modules/webpack/node_modules/fsevents gyp ERR! node -v v10.16.2 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/webpack/node_modules/fsevents): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild` npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1 + [email protected] updated 1 package in 22.243s
plan 1:
npm install --unsafe-perm=true --allow-root -g nodeppt
When the installation has been given nodeppt, add --unsafe-perm = true --allow-root through to find information, can solve the problem, git on Issue: https://github.com/npm/npm/issues/17268 , which program seemingly not so graceful, so look for the second option.
Scenario 2
1, the establishment of a global folder configuration
mkdir ~ /-global sea level altitude config set prefix '~ / asl-global'
ps: not to build to the point at the beginning of the configuration files mac, or otherwise can not solve (.).
2, modify environment variables
vi /etc/profile
If the file is read-only read and write permissions, and change it file
sudo chmod 777 /etc/profile
In the / etc / profile Append
# npm配置 export PATH=~/npm-global/bin:$PATH
3, activate the environment variable configuration
source /etc/profile
4, again installed by
i webpack -g /Users/xesfe/npm-config/bin/webpack -> /Users/xesfe/npm-config/lib/node_modules/webpack/bin/webpack.js > [email protected] install /Users/xesfe/npm-config/lib/node_modules/webpack/node_modules/fsevents > node-gyp rebuild SOLINK_MODULE(target) Release/.node CXX(target) Release/obj.target/fse/fsevents.o SOLINK_MODULE(target) Release/fse.node + [email protected]
OK, enough of the perfect solution permissions issues.