V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
adyyq
V2EX  ›  问与答

部署 hexo 到本地,浏览器打不开

  •  
  •   adyyq · 2018-12-11 19:46:45 +08:00 · 1708 次点击
    这是一个创建于 2181 天前的主题,其中的信息可能已经有所发展或是发生改变。
    CMD 里输入 hexo g 后显示

    adyan@adyan-PC MINGW32 /d/hexo
    $ hexo s
    Usage: hexo <command>

    Commands:
    help Get help on a command.
    init Create a new Hexo folder.
    version Display version information.

    Global Options:
    --config Specify config file instead of using _config.yml
    --cwd Specify the CWD
    --debug Display all verbose messages in the terminal
    --draft Display draft posts
    --safe Disable all plugins and scripts
    --silent Hide output on console

    For more help, you can use 'hexo help [command]' for the detailed information
    or you can check the docs: http://hexo.io/docs/

    adyan@adyan-PC MINGW32 /d/hexo
    $
    没有提示有这个地址的 http://localhost:4000/


    Node.js 和 git 都已经安装,并且测试成功。系统是 win7 的。
    7 条回复    2018-12-12 20:14:23 +08:00
    ysc3839
        1
    ysc3839  
       2018-12-11 19:54:04 +08:00 via Android
    ls 看看?
    wbing
        2
    wbing  
       2018-12-11 19:56:15 +08:00
    npm install hexo-server
    adyyq
        3
    adyyq  
    OP
       2018-12-11 20:03:36 +08:00
    @wbing 安装不成功,显示

    adyan@adyan-PC MINGW32 /d/hexo
    $ npm install hexo-server
    npm WARN saveError ENOENT: no such file or directory, open 'D:\hexo\package.json'
    npm notice created a lockfile as package-lock.json. You should commit this file.
    npm WARN enoent ENOENT: no such file or directory, open 'D:\hexo\package.json'
    npm WARN hexo No description
    npm WARN hexo No repository field.
    npm WARN hexo No README data
    npm WARN hexo No license field.

    + [email protected]
    added 50 packages from 26 contributors and audited 75 packages in 10.858s
    found 0 vulnerabilities


    adyan@adyan-PC MINGW32 /d/hexo
    $ hexo s
    Usage: hexo <command>

    Commands:
    help Get help on a command.
    init Create a new Hexo folder.
    version Display version information.

    Global Options:
    --config Specify config file instead of using _config.yml
    --cwd Specify the CWD
    --debug Display all verbose messages in the terminal
    --draft Display draft posts
    --safe Disable all plugins and scripts
    --silent Hide output on console

    For more help, you can use 'hexo help [command]' for the detailed information
    or you can check the docs: http://hexo.io/docs/

    adyan@adyan-PC MINGW32 /d/hexo
    $ npm install hexo-server
    npm WARN saveError ENOENT: no such file or directory, open 'D:\hexo\package.json'
    npm WARN enoent ENOENT: no such file or directory, open 'D:\hexo\package.json'
    npm WARN hexo No description
    npm WARN hexo No repository field.
    npm WARN hexo No README data
    npm WARN hexo No license field.

    + [email protected]
    updated 1 package and audited 228 packages in 3.84s
    found 0 vulnerabilities


    adyan@adyan-PC MINGW32 /d/hexo
    $ hexo g
    Usage: hexo <command>

    Commands:
    help Get help on a command.
    init Create a new Hexo folder.
    version Display version information.

    Global Options:
    --config Specify config file instead of using _config.yml
    --cwd Specify the CWD
    --debug Display all verbose messages in the terminal
    --draft Display draft posts
    --safe Disable all plugins and scripts
    --silent Hide output on console

    For more help, you can use 'hexo help [command]' for the detailed information
    or you can check the docs: http://hexo.io/docs/

    adyan@adyan-PC MINGW32 /d/hexo
    $ hexo s
    Usage: hexo <command>

    Commands:
    help Get help on a command.
    init Create a new Hexo folder.
    version Display version information.

    Global Options:
    --config Specify config file instead of using _config.yml
    --cwd Specify the CWD
    --debug Display all verbose messages in the terminal
    --draft Display draft posts
    --safe Disable all plugins and scripts
    --silent Hide output on console

    For more help, you can use 'hexo help [command]' for the detailed information
    or you can check the docs: http://hexo.io/docs/

    adyan@adyan-PC MINGW32 /d/hexo
    $
    mmdsun
        4
    mmdsun  
       2018-12-11 20:08:25 +08:00 via Android
    netstat -ano findstr| 4000 win 看看端口占用情况。被占用了吧
    vsitebon
        5
    vsitebon  
       2018-12-12 00:12:28 +08:00 via iPhone
    有可能两个原因,一个是你在_config.yml 里面添加了 plugins 字样。会导致 server 不起来。Hexo 3 以后不需要再手动添加插件到列表当中。第二个就是你的确没安装 hexo server。还有就是看你第二次的报错信息,你很有可能并没有在你初始化后的博客目录中使用 Hexo Server。是博客根目录,不是 Hexo 目录中
    adyyq
        6
    adyyq  
    OP
       2018-12-12 01:02:43 +08:00 via Android
    @vsitebon 谢谢,明天试试
    adyyq
        7
    adyyq  
    OP
       2018-12-12 20:14:23 +08:00
    @vsitebon 您好,config.yml 里确实有 public_dir: public 这一项,请问是把它删除保存么?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2708 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 09:07 · PVG 17:07 · LAX 01:07 · JFK 04:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.