macOS execution solutions npm install -g hexo-cli failure

Description: according to the official website of the installation hexotutorial command; Run npm install -g hexo-clitime, given the following solution

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/chokidar
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/hexo-cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/hexo-cli'
npm ERR!  [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/hexo-cli'] {
npm ERR!   stack: "Error: EACCES: permission denied, access '/usr/local/lib/node_modules/hexo-cli'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/hexo-cli'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yuanyi/.npm/_logs/2019-10-30T11_43_55_100Z-debug.log

Synchronization Bowen:


Installation Background:

hexoOfficial website: https://hexo.io/zh-cn/docs/index.html

Use macOS10.14.6installation hexotime, using the official command: npm install -g hexo-cliinstallation occurs, the following error;


The reason given:

A mistake (usually for this reason):

  • Cause of error ❎: do not use administrator privileges to install

    Note: Note that point : During the installation hexo, do not use sudothe command.

    Solution:

    The first step, given directory permissions:

    The second step, the installation hexo:

sudo chown -R `whoami` /usr/local/lib/node_modules
npm install hexo-cli -g

Error two:

  • Cause of error ❎: Due to npmthe official source image abroad, while domestic reasons due to network "known", the official visit of the default image source often go wrong we can change the country's image source to accelerate the installation of the software.

    Solution:

Replace the npmmirror source, it is recommended according to many users, it is recommended to use taobao the mirror source:

A permanent replacement npmfor the taobaomethod:

npm config set registry https://registry.npm.taobao.org

A permanent replacement npmfor the 官方源method:

npm config set registry https://registry.npmjs.org/

View settings are the npmsource of no effect:

npm config get registry

Reminder: use Taobao official source with the source and use may request fails, both of which are recommended to try here, according to their own circumstances

In conjunction with the above, attach a successful installation of the picture (as installed before, so the following):


Error three:

Forget Where to see an article, combined with my own experience with the previous tutorial hexo installation and, indeed, may be found to have shown insufficient authority, under macOS system, you need to add sudo to run the command:

sudo npm install hexo-cli -g

Here three for the solution under the above two methods are fail, you can try; many do not understand the principles, hope the friends laughed, this article here, right when a record, but if you can give inspiration, help to you, I am also very happy. Hear the Tao, Xi can die! And learning is endless, is willing to see and hear has been recorded, never sigh sigh born here; few heroes, but Hundred, time passed away, still remember dash? Weeds in the stars, their wonderful, are willing to work in the future may look


Below this article, written by really good, but also very clear, compared to a net other mostly a copy to ten, one hundred, one hundred spread throughout the network; it is not, or can not solve practical and there is no reason to say, several direct commands, so I deplore, put under a relatively crafted article, took thought to write, in this reference, thank

: Refer to the article configuration issues Hexo blog operating environment encountered a Mac system

Published 173 original articles · won praise 211 · views 280 000 +

Guess you like

Origin blog.csdn.net/qq_33154343/article/details/102887721