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

2018-12-11 19:46:45 +08:00
 adyyq
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 的。
1696 次点击
所在节点    问与答
7 条回复
ysc3839
2018-12-11 19:54:04 +08:00
ls 看看?
wbing
2018-12-11 19:56:15 +08:00
npm install hexo-server
adyyq
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.

+ hexo-server@0.3.3
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.

+ hexo-server@0.3.3
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
2018-12-11 20:08:25 +08:00
netstat -ano findstr| 4000 win 看看端口占用情况。被占用了吧
vsitebon
2018-12-12 00:12:28 +08:00
有可能两个原因,一个是你在_config.yml 里面添加了 plugins 字样。会导致 server 不起来。Hexo 3 以后不需要再手动添加插件到列表当中。第二个就是你的确没安装 hexo server。还有就是看你第二次的报错信息,你很有可能并没有在你初始化后的博客目录中使用 Hexo Server。是博客根目录,不是 Hexo 目录中
adyyq
2018-12-12 01:02:43 +08:00
@vsitebon 谢谢,明天试试
adyyq
2018-12-12 20:14:23 +08:00
@vsitebon 您好,config.yml 里确实有 public_dir: public 这一项,请问是把它删除保存么?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/516636

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX