hexojs / hexo-server

Server module for Hexo.
MIT License
78 stars 53 forks source link

[BUG] `hexo server` hanging forever when repo contains any invalid symbolic link #124

Open kuanyui opened 6 years ago

kuanyui commented 6 years ago

Environment Info

Node version(node -v): v6.9.1 (in nvm) OS: Chakra Linux

Your site _config.yml (Optional):

Your theme _config.yml (Optional):

Hexo and Plugin version(npm ls --depth 0):

hexo-site@0.0.0 /home/onohiroko/source-blog
├── hexo@3.2.2
├── hexo-cli@1.0.4
├── hexo-deployer-git@0.0.3
├── hexo-generator-archive@0.1.4
├── hexo-generator-category@0.1.3
├── hexo-generator-feed@1.2.0
├── hexo-generator-index@0.1.3
├── hexo-generator-sitemap@1.1.2
├── hexo-generator-tag@0.1.2
├── hexo-renderer-ejs@0.1.1
├── hexo-renderer-marked@0.2.11
├── hexo-renderer-stylus@0.2.3
├── hexo-server@0.1.3
└── xml2js@0.4.17

For question

After hexo server --debug, it stopped at a fixed point, then hang and server still not startup:

./node_modules/hexo-cli/bin/hexo server --debug                                                                                                                                                                (01-04 10:11)
02:11:19.915 DEBUG Hexo version: 3.2.2                                                 
02:11:19.917 DEBUG Working directory: ~/source-blog/                                   
02:11:19.988 DEBUG Config loaded: ~/source-blog/_config.yml                          
02:11:20.101 DEBUG Script loaded: scripts/livedoor-opml2md.js                          
02:11:20.101 DEBUG Script loaded: scripts/toc.js                                      
02:11:20.102 DEBUG Script loaded: themes/taiga/scripts/fancybox.js                        
02:11:20.103 DEBUG Plugin loaded: hexo-cli                                                  
02:11:20.105 DEBUG Plugin loaded: hexo-generator-archive                      
02:11:20.106 DEBUG Plugin loaded: hexo-generator-category                          
02:11:20.144 DEBUG Plugin loaded: hexo-deployer-git                                 
02:11:20.146 DEBUG Plugin loaded: hexo-generator-feed                             
02:11:20.146 DEBUG Plugin loaded: hexo-generator-index                                 
02:11:20.147 DEBUG Plugin loaded: hexo-generator-sitemap                              
02:11:20.149 DEBUG Plugin loaded: hexo-renderer-ejs                                  
02:11:20.230 DEBUG Plugin loaded: hexo-renderer-stylus                                                                                                                                                                                                              
02:11:20.231 DEBUG Plugin loaded: hexo-generator-tag                                                                                                                                                                                                                
02:11:20.235 DEBUG Plugin loaded: hexo-renderer-marked                  
02:11:20.273 DEBUG Plugin loaded: hexo-server                                                                                                                                                                                                                       
02:11:20.280 DEBUG Loading database.                                
02:11:20.451 INFO  Start processing                             
02:11:20.654 DEBUG Processed: _drafts/2017-malaysia-singapore.md      
......... (articles)
02:11:20.721 DEBUG Theme config loaded.                                              
02:11:20.722 DEBUG Processed: _config.yml                                                                                                                                                                                                                           
02:11:20.722 DEBUG Processed: image/banner/03.jpg                                                                                                                                                                                                                   
02:11:20.722 DEBUG Processed: image/banner/02.jpg                       
02:11:20.723 DEBUG Processed: lists/dist/ui-bootstrap-tpls-2.5.0.min.js                                                                                                                                                                                             
02:11:20.723 DEBUG Processed: transcription/Skyrim_Main_Theme.pdf   
......... (files)
02:11:20.854 DEBUG Processed: image/2014/IMG_6379.jpg                                      
02:11:20.854 DEBUG Processed: image/2014/IMG_6382.jpg                                   
02:11:20.860 DEBUG Processed: image/2014/IMG_6386.jpg                                 
02:11:20.897 DEBUG Processed: file/2015/1947_Overture_cover.pdf                      
^C02:14:02.583 INFO  See you again                                                      
02:14:02.633 DEBUG Database saved   

It freezed at 02:11:20.897, so I press ^C to interrupt.

Some possibly usable clues:

  1. Firewall is not running.
  2. I didn't encounter this problem on macOS.
  3. 4000 port is not be occupied by others.
  4. hexo is not installed system globally.
tomap commented 6 years ago

When it "freezed", did you tried to navigate at 127.0.0.1:4000 on your local browser ?

kuanyui commented 6 years ago

Yes, cannot open.

RupGautam commented 6 years ago

Why do you have node v6.9.x when it should be node v9.x.x? See hexojs/hexo#2534

kuanyui commented 6 years ago
  1. I've tried rm -rf node_modules in my hexo repository then reinstall everything via npm install (Also tried to reinstall everything with yarn, but get same issue.)
  2. I've tested this hexo repository could run under node v6.9.1 on my another system (macOS El Captain & High Sierra).
  3. node v9.x.x seems incompatible with hexo 3.2.2, get lots of errors when run.
  4. Surely, I always remember to rm -rf node_modules before changing the version of node via nvm use
kuanyui commented 6 years ago

I just try to use latest node.js LTS v8.9.4 carbon, hexo server still hang....... screenshot_20180114_220929 Even add --debug to hexo server, nothing else special outputs...

And I don't know why npm ls --depth 0 gives me lots of ERR:

[onohiroko@onohiroko-pc:~/source-blog]$ npm ls --depth 0                                                                                                                                                                                                                        
hexo-site@0.0.0 /home/onohiroko/source-blog                       
├── hexo@3.4.4                                                    
├── hexo-cli@1.0.4                                                 
├── hexo-deployer-git@0.3.1                                        
├── hexo-generator-archive@0.1.5                                       
├── hexo-generator-category@0.1.3                                      
├── hexo-generator-feed@1.2.2                                      
├── hexo-generator-index@0.2.1                                    
├── hexo-generator-sitemap@1.2.0                                               
├── hexo-generator-tag@0.2.0                                             
├── hexo-renderer-ejs@0.3.1                                              
├── hexo-renderer-marked@0.3.2                                       
├── hexo-renderer-stylus@0.3.3                                                                                                                                                                                                                                                                
├── hexo-server@0.3.1
└── xml2js@0.4.19

npm ERR! missing: hawk@3.1.3, required by node-pre-gyp@0.6.39
npm ERR! missing: mkdirp@0.5.1, required by node-pre-gyp@0.6.39
npm ERR! missing: rimraf@2.6.1, required by node-pre-gyp@0.6.39
npm ERR! missing: tar@2.2.1, required by node-pre-gyp@0.6.39
npm ERR! missing: boom@2.10.1, required by hawk@3.1.3
npm ERR! missing: cryptiles@2.0.5, required by hawk@3.1.3
npm ERR! missing: hoek@2.16.3, required by hawk@3.1.3
npm ERR! missing: sntp@1.0.9, required by hawk@3.1.3
npm ERR! missing: hoek@2.16.3, required by boom@2.10.1
npm ERR! missing: boom@2.10.1, required by cryptiles@2.0.5
npm ERR! missing: hoek@2.16.3, required by sntp@1.0.9
npm ERR! missing: minimist@0.0.8, required by mkdirp@0.5.1
npm ERR! missing: console-control-strings@1.1.0, required by npmlog@4.1.0
npm ERR! missing: readable-stream@2.2.9, required by are-we-there-yet@1.1.4
npm ERR! missing: console-control-strings@1.1.0, required by gauge@2.7.4
npm ERR! missing: string-width@1.0.2, required by gauge@2.7.4
npm ERR! missing: strip-ansi@3.0.1, required by gauge@2.7.4
npm ERR! missing: code-point-at@1.1.0, required by string-width@1.0.2
npm ERR! missing: is-fullwidth-code-point@1.0.0, required by string-width@1.0.2
npm ERR! missing: strip-ansi@3.0.1, required by string-width@1.0.2
npm ERR! missing: number-is-nan@1.0.1, required by is-fullwidth-code-point@1.0.0
npm ERR! missing: ansi-regex@2.1.1, required by strip-ansi@3.0.1
npm ERR! missing: string-width@1.0.2, required by wide-align@1.1.2
npm ERR! missing: combined-stream@1.0.5, required by request@2.81.0
npm ERR! missing: hawk@3.1.3, required by request@2.81.0
npm ERR! missing: mime-types@2.1.15, required by request@2.81.0
npm ERR! missing: safe-buffer@5.0.1, required by request@2.81.0
npm ERR! missing: delayed-stream@1.0.0, required by combined-stream@1.0.5
npm ERR! missing: combined-stream@1.0.5, required by form-data@2.1.4
npm ERR! missing: mime-types@2.1.15, required by form-data@2.1.4
npm ERR! missing: extsprintf@1.0.2, required by jsprim@1.4.0
npm ERR! missing: extsprintf@1.0.2, required by verror@1.3.6
npm ERR! missing: jsbn@0.1.1, required by sshpk@1.13.0
npm ERR! missing: jsbn@0.1.1, required by ecc-jsbn@0.1.1
npm ERR! missing: jsbn@0.1.1, required by jodid25519@1.0.2
npm ERR! missing: mime-db@1.27.0, required by mime-types@2.1.15
npm ERR! missing: safe-buffer@5.0.1, required by tunnel-agent@0.6.0
npm ERR! missing: glob@7.1.2, required by rimraf@2.6.1
npm ERR! missing: fs.realpath@1.0.0, required by glob@7.1.2
npm ERR! missing: inflight@1.0.6, required by glob@7.1.2
npm ERR! missing: inherits@2.0.3, required by glob@7.1.2
npm ERR! missing: minimatch@3.0.4, required by glob@7.1.2
npm ERR! missing: once@1.4.0, required by glob@7.1.2
npm ERR! missing: path-is-absolute@1.0.1, required by glob@7.1.2
npm ERR! missing: once@1.4.0, required by inflight@1.0.6
npm ERR! missing: wrappy@1.0.2, required by inflight@1.0.6
npm ERR! missing: brace-expansion@1.1.7, required by minimatch@3.0.4
npm ERR! missing: balanced-match@0.4.2, required by brace-expansion@1.1.7
npm ERR! missing: concat-map@0.0.1, required by brace-expansion@1.1.7
npm ERR! missing: block-stream@0.0.9, required by tar@2.2.1
npm ERR! missing: fstream@1.0.11, required by tar@2.2.1
npm ERR! missing: inherits@2.0.3, required by tar@2.2.1
npm ERR! missing: inherits@2.0.3, required by block-stream@0.0.9
npm ERR! missing: graceful-fs@4.1.11, required by fstream@1.0.11
npm ERR! missing: inherits@2.0.3, required by fstream@1.0.11
npm ERR! missing: mkdirp@0.5.1, required by fstream@1.0.11
npm ERR! missing: rimraf@2.6.1, required by fstream@1.0.11
npm ERR! missing: fstream@1.0.11, required by tar-pack@3.4.0
npm ERR! missing: once@1.4.0, required by tar-pack@3.4.0
npm ERR! missing: readable-stream@2.2.9, required by tar-pack@3.4.0
npm ERR! missing: rimraf@2.6.1, required by tar-pack@3.4.0
npm ERR! missing: tar@2.2.1, required by tar-pack@3.4.0
npm ERR! missing: fstream@1.0.11, required by fstream-ignore@1.0.5
npm ERR! missing: inherits@2.0.3, required by fstream-ignore@1.0.5
npm ERR! missing: minimatch@3.0.4, required by fstream-ignore@1.0.5
npm ERR! missing: wrappy@1.0.2, required by once@1.4.0
npm ERR! missing: buffer-shims@1.0.0, required by readable-stream@2.2.9
npm ERR! missing: core-util-is@1.0.2, required by readable-stream@2.2.9
npm ERR! missing: inherits@2.0.3, required by readable-stream@2.2.9
npm ERR! missing: isarray@1.0.0, required by readable-stream@2.2.9
npm ERR! missing: process-nextick-args@1.0.7, required by readable-stream@2.2.9
npm ERR! missing: string_decoder@1.0.1, required by readable-stream@2.2.9
npm ERR! missing: util-deprecate@1.0.2, required by readable-stream@2.2.9
npm ERR! missing: safe-buffer@5.0.1, required by string_decoder@1.0.1
[onohiroko@onohiroko-pc:~/source-blog]$ nvm ls                                                                                                                                                                                                                                   (01-14 22:26)
        v0.8.26
         v6.9.1
->       v8.9.4
         v9.3.0
         system
default -> v6.9.1
node -> stable (-> v9.3.0) (default)
stable -> 9.3 (-> v9.3.0) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> v8.9.4)
lts/argon -> v4.8.7 (-> N/A)
lts/boron -> v6.12.3 (-> N/A)
lts/carbon -> v8.9.4
[onohiroko@onohiroko-pc:~/source-blog]$ which hexo                                                                                                                                                                                                                               (01-14 22:33)
/home/onohiroko/source-blog/node_modules/.bin/hexo
RupGautam commented 6 years ago

Hey @kuanyui , I tired node v. 8.x.x LTS on Arch Linux and I couldn't replicate the issue. I'm assuming it could be your system specific. Also, you sure you have nothing run on port that hexo is using?

Check it using netstat or something similar $ netstat -na | grep -i LISTEN $ netstat -f inet -na | grep -i LISTEN

Another check, I'm not sure if you have already done it.

kuanyui commented 6 years ago

screenshot_20180210_204218 F-I-N-A-L-L-L-Y ! I found where the problem is! See the screenshot, there's a symbolic link (I don't know how on earth it appeared at first), and this symbolic link has invalid target. rm this file, hexo server works.

I think this is a bug that should be fixed. I don't know what things hexo-server has done, but I've ever tried to use http-server to serve the same repository and encountered no problem like this.

RupGautam commented 6 years ago

Good job! But I'm not convinced it's related to HexoJS server tho. Hey @NoahDragon, Can you look at this?

yanickxia commented 4 years ago

Me toooo....

➜  source git:(private-master) ✗ find . -type l -ls

  8522124      4 lrwxrwxrwx   1 yanick   yanick         72 6月 15 19:05 ./_posts/java/networking/java-nio-1-basic.md -> ../../../../../yann-hexo-blog/source/_posts/java/nio/java-nio-1-basic.md
  8522129      4 lrwxrwxrwx   1 yanick   yanick         77 6月 15 19:05 ./_posts/java/networking/netty/netty-3-pipeline.md -> /Users/yann/codes/yann-hexo-blog/source/_posts/java/netty/netty-3-pipeline.md
  8522126      4 lrwxrwxrwx   1 yanick   yanick         76 6月 15 19:05 ./_posts/java/networking/netty/netty-0-prepare.md -> /Users/yann/codes/yann-hexo-blog/source/_posts/java/netty/netty-0-prepare.md
  8522130      4 lrwxrwxrwx   1 yanick   yanick         76 6月 15 19:05 ./_posts/java/networking/netty/netty-4-bytebuf.md -> /Users/yann/codes/yann-hexo-blog/source/_posts/java/netty/netty-4-bytebuf.md
  8522128      4 lrwxrwxrwx   1 yanick   yanick         84 6月 15 19:05 ./_posts/java/networking/netty/netty-2-acceptor-thread.md -> /Users/yann/codes/yann-hexo-blog/source/_posts/java/netty/netty-2-acceptor-thread.md
  8522127      4 lrwxrwxrwx   1 yanick   yanick         78 6月 15 19:05 ./_posts/java/networking/netty/netty-1-bootstrap.md -> /Users/yann/codes/yann-hexo-blog/source/_posts/java/netty/netty-1-bootstrap.md
  8522131      4 lrwxrwxrwx   1 yanick   yanick         70 6月 15 19:05 ./_posts/java/projectreactor.md -> ../../../../yann-hexo-blog/source/_posts/java/spring/projectreactor.md

delete all... then everything be ok...