Hexo: 执行hexo init时候发生:hexo:command not found

Created on 8 Apr 2016  ·  12Comments  ·  Source: hexojs/hexo

I have installed hexo nodejs GIT ,when i create a new profile,cd to this ,and "hexo init" by git bash, It's show "hexo:command not found".
2 days ,waitting for the answer online ... #285

已经安装了nodejs git hexo 但是在新建文件夹下gitbash的时候 :hexo:command not found
请教怎么解决,在线等

Most helpful comment

补充一下:我的是在linux环境下遇到该问题,报错原因是安装时权限不够,然后解决方法是重新运行$ sudo npm install hexo-cli -g
参考:-bash: hexo: command not found解决办法

All 12 comments

problem solved ,hah...

@eyeA 请问你的问题是怎么解决的?我用npm install hexo-cli -g安装,总是最后提示:

npm WARN optional Skipping failed optional dependency /hexo-cli/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]

打hexo -v,cmd提示'hexo'不是内部或外部命令

@uolcano warn 提示,不会影响你后续的操作的,可以暂时忽略。
在环境变量path设置下hexo的安装目录

@eyeA thx,其实我这问题还有就是命令行不是别hexo命令。重装node,就ok了。估计是我装jekyll的时候,改path哪里弄删错了。

Closed for sloved.

补充一下:我的是在linux环境下遇到该问题,报错原因是安装时权限不够,然后解决方法是重新运行$ sudo npm install hexo-cli -g
参考:-bash: hexo: command not found解决办法

@leoyip yes , its works ! thank you so much,

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\hexo-cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
这个问题怎么解决啊 也找不到我的hexo
是不是需要重新安装node 的版本

重新安装一下nodejs,或者在删除应用的面板中选择修复一下nodejs应该就可以了

I solved by

ln -s /usr/local/bin/hexo /usr/bin/hexo
ln -s /usr/local/bin/node /usr/bin/node

bash: hexo: command not found
我也是遇到了这个问题尝试了
hexo s
hexo g
hexo d
尝试以上的命令都不行。
我猜想,是不是我在清理系统垃圾的时候删除了什么配置的东西?我还没有检查。

我之前也是遇到:

$ npm install hexo-cli -g
C:\Users\John\AppData\Roaming\npm\hexo -> C:\Users\John\AppData\Roaming\npm\node                                                                                                                                                 _modules\hexo-cli\bin\hexo
npm WARN rollback Rolling back [email protected] failed (this is probably harmle                                                                                                                                                 ss): EPERM: operation not permitted, scandir 'C:\Users\John\AppData\Roaming\npm\                                                                                                                                                 node_modules\hexo-cli\node_modules\fsevents\node_modules'
npm WARN rollback Rolling back [email protected] failed (this is probably ha                                                                                                                                                 rmless): EPERM: operation not permitted, scandir 'C:\Users\John\AppData\Roaming\                                                                                                                                                 npm\node_modules\hexo-cli\node_modules\fsevents'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\hex                                                                                                                                                 o-cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@                                                                                                                                                 1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}                                                                                                                                                 )

+ [email protected]
added 225 packages from 433 contributors in 64.606s

John@SC-201703161801 MINGW64 ~
$

John@SC-201703161801 MINGW64 ~
$ pwd
/c/Users/John

John@SC-201703161801 MINGW64 ~
$ hexo init blog
bash: hexo: command not found

看到 @leoyip 的回复用管理员身份打开Git Bash成功了:

Administrator@SC-201703161801 MINGW64 /c/Users/John
$ npm install hexo-cli -g
C:\Users\Administrator\AppData\Roaming\npm\hexo -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\hexo-cli\bin\hexo
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\hexo-cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ [email protected]
added 225 packages from 433 contributors in 54.886s

Administrator@SC-201703161801 MINGW64 /c/Users/John
$ hexo init blog
INFO  Cloning hexo-starter to C:\Users\John\blog
Cloning into 'C:\Users\John\blog'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 71 (delta 0), reused 0 (delta 0), pack-reused 68
Unpacking objects: 100% (71/71), done.
Submodule 'themes/landscape' (https://github.com/hexojs/hexo-theme-landscape.git) registered for path 'themes/landscape'
Cloning into 'C:/Users/John/blog/themes/landscape'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 867 (delta 0), reused 0 (delta 0), pack-reused 866
Receiving objects: 100% (867/867), 2.55 MiB | 79.00 KiB/s, done.
Resolving deltas: 100% (459/459), done.
Submodule path 'themes/landscape': checked out '73a23c51f8487cfcd7c6deec96ccc7543960d350'
INFO  Install dependencies
npm WARN deprecated [email protected]: no longer maintained
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\John\blog\node_modules\fsevents'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 421 packages from 503 contributors and audited 4697 packages in 70.287s
found 2 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
INFO  Start blogging with Hexo!

感谢。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dsaltares picture dsaltares  ·  46Comments

LouisBarranqueiro picture LouisBarranqueiro  ·  28Comments

ghost picture ghost  ·  27Comments

curbengh picture curbengh  ·  21Comments

fishercoder1534 picture fishercoder1534  ·  26Comments