Reputation:
The node version is:
node -v
v8.9.1
I tried to install hexo-cli by following the official guide:
npm install -g hexo-cli
and got the errors:
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/mkdirp
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/randomatic
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/regex-cache
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/remove-trailing-separator
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/normalize-path
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/repeat-element
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/repeat-string
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/fill-range
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/expand-range
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/braces
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/micromatch
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/anymatch
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/safe-buffer
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/safe-json-stringify
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/set-immediate-shim
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/string_decoder
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/strip-ansi
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/striptags
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/supports-color
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/chalk
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/upper-case
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/camel-case
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/util-deprecate
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/readable-stream
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/readdirp
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/chokidar
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/which
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/wrappy
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/once
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/inflight
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/glob
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/rimraf
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/mv
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-bunyan
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/yallist
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/lru-cache
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/cross-spawn
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/abbrev
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/command-exists
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-fs
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-log
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-util
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/[email protected]@is-number/node_modules/kind-of
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/object-assign
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/tildify
npm ERR! path /usr/local/lib/node_modules/hexo-cli/node_modules/mkdirp
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access '/usr/local/lib/node_modules/hexo-cli/node_modules/mkdirp'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/judy/.npm/_logs/2018-01-28T06_55_07_544Z-debug.log.
And then I tried the same command at least 5 times and get the same errors. I also tried to add sudo :
sudo npm install -g hexo-cli
and the same error occurred.
As far as I am concerned, the function of yarn add
equals to npm install
, so I tried:
yarn add hexo-cli -g
yarn add v0.27.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.3.2" while you're on "0.27.5".
info To upgrade, run the following command:
$ npm upgrade --global yarn
success Saved 180 new dependencies.
It seems that the hexo-cli has been installed successfully. But when I run the command hexo it shows that:
hexo
-bash: hexo: command not found.
It seems to be a problem with npm, but I don't know how to solve it. Any idea? Thanks in advance.
Upvotes: 0
Views: 289