mac Error: EACCES: permission denied, mkdir './cache'

网友投稿 550 2022-08-27

mac Error: EACCES: permission denied, mkdir './cache'

我的系统是mac,我在输入下面的命令:

sudo npm install -g aglio

出现了下面的问题:

npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)npm WARN deprecated jade@1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jadenpm WARN deprecated constantinople@3.0.2: Please update to at least constantinople 3.1.1npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformernpm WARN deprecated hoek@2.16.3: This version is no longer maintained. Please upgrade to the latest version.npm WARN deprecated boom@2.10.1: This version is no longer maintained. Please upgrade to the latest version.npm WARN deprecated cryptiles@2.0.5: This version is no longer maintained. Please upgrade to the latest version.npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue/usr/local/bin/aglio -> /usr/local/lib/node_modules/aglio/bin/aglio.js> fsevents@1.2.7 install /usr/local/lib/node_modules/aglio/node_modules/fsevents> node installnode-pre-gyp WARN Using request for node-pre-gyp downloadnode-pre-gyp WARN Pre-built binaries not installable for fsevents@1.2.7 and node@8.12.0 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib'gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/eric/.node-gyp/8.12.0"gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/aglio/node_modules/fsevents/.node-gyp"gyp WARN install got an error, rolling back installgyp WARN install got an error, rolling back installgyp ERR! configure errorgyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/aglio/node_modules/fsevents/.node-gyp'gyp ERR! System Darwin 18.0.0gyp 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/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"gyp ERR! cwd /usr/local/lib/node_modules/aglio/node_modules/fseventsgyp ERR! node -v v8.12.0gyp ERR! node-gyp -v v3.8.0gyp ERR! not oknode-pre-gyp ERR! build errornode-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/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)node-pre-gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/aglio/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)node-pre-gyp ERR! stack at emitTwo (events.js:126:13)node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:915:16)node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)node-pre-gyp ERR! System Darwin 18.0.0node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/aglio/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"node-pre-gyp ERR! cwd /usr/local/lib/node_modules/aglio/node_modules/fseventsnode-pre-gyp ERR! node -v v8.12.0node-pre-gyp ERR! node-pre-gyp -v v0.10.3node-pre-gyp ERR! not okFailed 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/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)> protagonist@1.6.8 install /usr/local/lib/node_modules/aglio/node_modules/protagonist> node-gyp rebuildgyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/eric/.node-gyp/8.12.0"gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/aglio/node_modules/protagonist/.node-gyp"gyp WARN install got an error, rolling back installgyp WARN install got an error, rolling back installgyp ERR! configure errorgyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/aglio/node_modules/protagonist/.node-gyp'gyp ERR! System Darwin 18.0.0gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"gyp ERR! cwd /usr/local/lib/node_modules/aglio/node_modules/protagonistgyp ERR! node -v v8.12.0gyp ERR! node-gyp -v v3.8.0gyp ERR! not ok> aglio-theme-olio@1.6.3 postinstall /usr/local/lib/node_modules/aglio/node_modules/aglio-theme-olio> node scripts/setup-cache.jsfs.js:885 return binding.mkdir(pathModule._makeLong(path), ^Error: EACCES: permission denied, mkdir './cache' at Object.fs.mkdirSync (fs.js:885:18) at Object. (/usr/local/lib/node_modules/aglio/node_modules/aglio-theme-olio/scripts/setup-cache.js:14:6) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Function.Module.runMain (module.js:694:10) at startup (bootstrap_node.js:204:16) at bootstrap_node.js:625:3npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/aglio/node_modules/fsevents):npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 install: `node install`npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1npm WARN optional SKIPPING OPTIONAL DEPENDENCY: protagonist@1.6.8 (node_modules/aglio/node_modules/protagonist):npm WARN optional SKIPPING OPTIONAL DEPENDENCY: protagonist@1.6.8 install: `node-gyp rebuild`npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! aglio-theme-olio@1.6.3 postinstall: `node scripts/setup-cache.js`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the aglio-theme-olio@1.6.3 postinstall script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR! /Users/eric/.npm/_logs/2019-02-14T00_47_21_128Z-debug.log

查资料发现,正确的做法应该是:

sudo npm install -g aglio --unsafe-perm=true --allow-root

然后就可以正常了。

参考文献

[1].Error: EACCES: permission denied, mkdir '/root/.nvm/versions/node/....... ​​https://jianshu.com/p/6c67a456654b​​

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:拒绝盲目跟风营销,中小企业出海可从3点入手!
下一篇:[leetcode] 846. Hand of Straights
相关文章

 发表评论

暂时没有评论,来抢沙发吧~