Download today wepy-cli when the incorrect report
sudo above sea level and wepy -g-cli
gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/.node-gyp' gyp ERR! System Darwin 19.2.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=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72" gyp ERR! cwd /usr/local/lib/node_modules/wepy-cli/node_modules/fsevents gyp ERR! node -v v12.13.1 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:210:5) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
That there is no authority, how can I add sudo Yeah.
Shetenglebantian found a command
sudo npm install --unsafe-perm -g wepy-cli
that's it.
why?
A: That npm For security reasons does not support running as root, even if you run with the root user, npm will be automatically converted into a user called nobody to run, while the user is almost no rights. So if you have some need permission to script operations, such as writing documents (especially write /root/.node-gyp), it will be bounced off.
To avoid this, either to npm accordance with the rules, specifically built for running npm a high privileged user; adding --unsafe-perm or parameters, so it will not switch to nobody, which is user runtime which is user, even root.