Gatsby: 热重载错误

创建于 2017-11-22  ·  3评论  ·  资料来源: gatsbyjs/gatsby

Steps脚步

  1. gatsby new tutorial-part-one https://github.com/gatsbyjs/gatsby-starter-hello-world
  2. cd tutorial-part-one && gatsby develop
  3. Initial view初始视图

first

  1. Edit index.js in src/pages/ and save the file.编辑index.js中的src/pages/并保存文件。

react

  1. View after hot reload.热重载后查看。

first

Expected behavior预期行为

Gatsby's development server should hot reload in the browser and reflect changes made in src/pages/index.js . Gatsby 的开发服务器应该在浏览器中热重载并反映在src/pages/index.js中所做的更改。 The view must be as below:视图必须如下:

second

Actual behavior实际行为

No hot reloading in the browser.浏览器中没有热重载。

Errors in console控制台中的错误

error

For changes to get reflected the browser needs to be refreshed.为了使更改得到反映,需要刷新浏览器。

en

最有用的评论

It works for me when I start the server with gatsby develop --host localhost .当我使用gatsby develop --host localhost启动服务器时,它对我有用。 This is either unexpected behavior or should be added to all tutorials that mention hot reloading with gatsby develop .这要么是意外行为,要么应该添加到所有提到使用gatsby develop进行热重载的教程中。

en

所有3条评论

It works for me when I start the server with gatsby develop --host localhost .当我使用gatsby develop --host localhost启动服务器时,它对我有用。 This is either unexpected behavior or should be added to all tutorials that mention hot reloading with gatsby develop .这要么是意外行为,要么应该添加到所有提到使用gatsby develop进行热重载的教程中。

en

@andreasgruenh添加gatsby develop --host localhost不会将开发服务器暴露给网络。

en

Hi @andreasgruenh @gagan0723 please see https://github.com/gatsbyjs/gatsby/pull/2983#issuecomment -346126702 and https://github.com/gatsbyjs/gatsby/issues/2960#issuecomment -346130796 and more recent comments.@andreasgruenh @gagan0723请参阅https://github.com/gatsbyjs/gatsby/pull/2983#issuecomment -346126702 和https://github.com/gatsbyjs/gatsby/issues/2960#issuecomment -346130796 和更多最新评论. Looks like we should default to localhost on Mac as well to avoid these.看起来我们应该在 Mac 上默认为localhost以避免这些。 For local network testing on Mac can do -H [machine_name].local , any of that help?对于 Mac 上的本地网络测试可以做-H [machine_name].local ,有什么帮助吗?

en
此页面是否有帮助?
0 / 5 - 0 等级

相关问题

mikestopcontinues picture mikestopcontinues  ·  3评论

benstr picture benstr  ·  3评论

theduke picture theduke  ·  3评论

3CordGuy picture 3CordGuy  ·  3评论

andykais picture andykais  ·  3评论