Hexo: ERROR Local hexo not found

Created on 2 Aug 2016  ·  46Comments  ·  Source: hexojs/hexo

I am unable to run the hexo command inside a hexo blog directory.

dsaltares@saltares:/home/dsaltares/hexo_blog: hexo
ERROR Local hexo not found in ~/hexo_blog
ERROR Try running: 'npm install hexo --save'

The --save option does nothing really.

However I did install hero-cli and hero-server using npm install -g.

I am using nvm to manage node versions.

dsaltares@saltares:/home/dsaltares/hexo_blog: nvm --version
0.31.4
dsaltares@saltares:/home/dsaltares/hexo_blog: node -v
v6.3.1
dsaltares@saltares:/home/dsaltares/hexo_blog: npm --v
3.10.3

The same also happens with node 4 and node 5.

Most helpful comment

A solution that worked for me to is removing the node_modules/ directory and reinstall it, so run:
rm -rf node_modules/ && npm install

All 46 comments

I have the same problem.

git version 1.9.1
node version v4.5.0
npm version 2.15.9

I'm having the same problem on windows as well.

Windows 10
git version: 2.9.0
node version: v6.6.0
npm version: 3.10.3

vagrant
i have the same problem on vagrant

Same here.

Same here

same here

I don't know the reason, but somehow my config is working now.

Same here. Just installed a plugin and updated to the latest hexo version and hexo stopped working. It ran all day without a hitch, plugin install (hexo-tag-googlemaps) and its "gone". Plugin uninstall did not change anything - keeps being broken.

○ → hexo serve ERROR Local hexo not found in unicante-hexo ERROR Try running: 'npm install hexo --save'

Update

I restored my hexo folder from a time machine backup on my mac. Hexo works again. Must have been something that happened when I did the npm install

Any fix for this? Am having the same issue

@Shane24 I have this issue before, but somehow reinstall the npm environment, the issue is gone. No ideas how exactly to fix this.

_Update I created another website with hexo init site2, removed my original site and cloned it again and this time hexo generate worked, not sure what happened though._

I'm having this exact error after a successful install of node-gyp.
For example: hexo generate on a previously existing website throws the same error:

ERROR Local hexo not found in ~\hexo\site
ERROR Try running: 'npm install hexo --save'

But I can successfully use hexo init with a new folder and then use hexo [command] inside the created folder.

i fixed it,and i reinstall the npm install -g node-gyp you can have a try

I have the same problem... npm install -g node-gyp didn't solve this problem...:(

Edit:
Everything is fine if I use hexo init to create a new blog and use hexo server to run it..... but it doesn't work in the old project folder

Same here...

same here

same here

I had the same problem. For me even starting a fresh blog through hexo init would give this "Local hexo not found" error message.

What worked for me: I uninstalled and then reinstalled node.js through homebrew and now things are working again. Go figure...

A solution that worked for me to is removing the node_modules/ directory and reinstall it, so run:
rm -rf node_modules/ && npm install

Thanks @JohannHospice @cbellei .
According @JohannHospice solution, my steps are below:

  1. delete the cache,change travis file
  2. hexo clean, hexo generate . Everything goes well
  3. Add the cache again, It still goes well. Add the cache in travis file

@JohannHospice Thanks,it works

@JohannHospice Thanks,it works

@JohannHospice Thanks,it works!!

Close this issue, as @JohannHospice provided the solution.

I have tried as JohannHospice said,but it seems that it doesn't work.
(I attemped to upload a screenshot,but failed)

LOOK@PC-2015 MINGW64 /e/blog/2016lkaust.github.io
$ npm install
npm WARN deprecated [email protected]: This package is no longer maintained
npm WARN prefer global [email protected] should be installed with -g

> [email protected] install E:\blog\2016lkaust.github.io\node_modules\dtrace-provider
> node scripts/install.js

LOOK@PC-2015 MINGW64 /e/blog/2016lkaust.github.io
$ hexo
ERROR Local hexo not found in E:\blog\2016lkaust.github.io
ERROR Try running: 'npm install hexo --save'

LOOK@PC-2015 MINGW64 /e/blog/2016lkaust.github.io
$

@2016lkaust This is an know issue and will be fixed in next build. Please call hexo command with argument, like run hexo init should be fine. https://github.com/hexojs/hexo/pull/2520

@JohannHospice Thanks

@JohannHospice thanks a lot . i meet this error after installed hexo-migrator-rss plugin. may be there something wrong

same here

After reinstalling npm using nvm install stable, and again using the method of @JohannHospice, rm -rf node_modules/ && npm install.

I fixed my error. Hope it works.

@JohannHospice nice and thx!

maybe your Nodejs version is too old.
see here

@xpgeng resolved as you said
nvm install stable and sudo npm install -g hexo

@Anakinliu reinstalled Nodejs,then it worked,thx!

@xpgeng -rf node_modules/ && npm install this works in my situation

maker

to all , update nodejs to latest version and exec rm -rf node_modules/ && nam install ,it work for me !

mac os update nodejs
Here's how I successfully upgraded from v0.8.18 to v0.10.20 without any other requirements like brew etc, (type these commands in terminal):

sudo npm cache clean -f (force) clear you npm cache
sudo npm install -g n install "n" (this might take a while)
sudo n stable upgrade to lastest version
Note that sudo might prompt your password.

If the version number doesn't show up when typing node -v, you might have to reboot.

these instructions are found here as well: davidwalsh.name/upgrade-nodejs

upgrade nodejs works for me.

run npm install hexo --save in base directory of blog, this works for me

upgrade nodejs works for me.

so am i

???

I have the same problem. I have tried all the above-mentioned solution, but nothing worked out.
The problem accrued after doing some tricks in the theme (I am using Hueman)
any advice how to fix this?

Found the solution.
manually deleted the whole node folder and installed it again with "npm install" within my hexo folder.
That is my solution - for me it worked out fine.

A solution that worked for me to is removing the node_modules/ directory and reinstall it, so run:
rm -rf node_modules/ && npm install

Good. It's working.

hope this will help somebody: in my case i upgrade node from v8.11.2 to v14.*, and then it works

Was this page helpful?
0 / 5 - 0 ratings